spec/lib/smilodon_spec.rb in smilodon-0.2.2 vs spec/lib/smilodon_spec.rb in smilodon-0.2.3

- old
+ new

@@ -21,11 +21,11 @@ end end describe FakePopulator, '.file' do it 'should return the configured file name' do - FakePopulator.file.should == 'TestFile' + FakePopulator.files.should == ['TestFile'] end end describe FakePopulator, '.type' do context 'when no file type is configured' do @@ -44,7 +44,22 @@ describe FakePopulator, '.process(row)' do it 'should raise an exception with a message to define the method in the extended populator class' do lambda { FakePopulator.process }.should raise_exception(MethodNotOverridden) + end +end + +describe FakePopulator, '.files' do + it 'should return the configured file names' do + FakePopulatorWithMultipleFiles.files.should == ['TestFile1', 'TestFile2', 'TestFile3'] + end + + it 'should handle an options hash' do + FakePopulatorWithMultipleFiles.directory.should == 'db/populate/files' + end + + it 'calls read for each file passed to populate' do + FakePopulatorWithMultipleFiles.files.each { |f| FakePopulatorWithMultipleFiles.should_receive(:read).with(f).and_return('') } + FakePopulatorWithMultipleFiles.run end end