Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 390
- Log:
Initial import of Canvass, a donations-based poll application.
- Author:
- rool
- Date:
- Mon Mar 21 14:58:04 +0000 2011
- Size:
- 1065 Bytes
1 | require File.dirname(__FILE__) + '/base' |
2 | |
3 | describe YamlDb::Load do |
4 | before do |
5 | SerializationHelper::Utils.stub!(:quote_table).with('mytable').and_return('mytable') |
6 | |
7 | silence_warnings { ActiveRecord::Base = mock('ActiveRecord::Base', :null_object => true) } |
8 | ActiveRecord::Base.connection = mock('connection') |
9 | ActiveRecord::Base.connection.stub!(:transaction).and_yield |
10 | end |
11 | |
12 | before(:each) do |
13 | @io = StringIO.new |
14 | end |
15 | |
16 | |
17 | it "should call load structure for each document in the file" do |
18 | YAML.should_receive(:load_documents).with(@io).and_yield({ 'mytable' => { |
19 | 'columns' => [ 'a', 'b' ], |
20 | 'records' => [[1, 2], [3, 4]] |
21 | } } ) |
22 | YamlDb::Load.should_receive(:load_table).with('mytable', { 'columns' => [ 'a', 'b' ], 'records' => [[1, 2], [3, 4]] },true) |
23 | YamlDb::Load.load(@io) |
24 | end |
25 | |
26 | it "should not call load structure when the document in the file contains no records" do |
27 | YAML.should_receive(:load_documents).with(@io).and_yield({ 'mytable' => nil }) |
28 | YamlDb::Load.should_not_receive(:load_table) |
29 | YamlDb::Load.load(@io) |
30 | end |
31 | |
32 | end |