end
end
context 'つつがなく終わるとき' do
- it '空っぽの配列を返す' do
+ it 'ImportResultを返す' do
r = ProviderArtist.import @provider.id, [@artist.attributes]
- r.should be_empty
+ r.is_a?(ImportResult).should be_true
+ r.should be_success
end
it '対照表が追加される' do
lambda {
end
end
context '複数インポートのとき' do
- it '空っぽの配列を返す' do
+ it 'ImportResultを返す' do
r = ProviderArtist.import @provider.id, [@artist.attributes, @artist2.attributes]
- r.should be_empty
+ r.is_a?(ImportResult).should be_true
+ r.should be_success
end
it '対照表が追加される' do
lambda {
before do
ProviderArtist.any_instance.stub(:save).with(any_args).and_return(false)
end
- it '結果に貸手側絵師のカラム値を追加している' do
+ it '結果が失敗している' do
r = ProviderArtist.import @provider.id, [@artist.attributes]
- r.should_not be_empty
+ r.should_not be_success
+ r.failures.should_not be_empty
end
end
context '絵師オブジェクトの保存に失敗したとき' do
before do
Artist.any_instance.stub(:save).with(any_args).and_return(false)
end
- it 'çµ\90æ\9e\9cã\81«è²¸æ\89\8bå\81´çµµå¸«ã\81®ã\82«ã\83©ã\83 å\80¤ã\82\92追å\8a している' do
+ it 'çµ\90æ\9e\9cã\81\8c失æ\95\97している' do
r = ProviderArtist.import @provider.id, [@artist.attributes]
- r.should_not be_empty
+ r.should_not be_success
+ r.failures.should_not be_empty
end
end
end