Skip to content

Commit 11b42bb

Browse files
committed
Add spec for missing image attributes
1 parent c436fb7 commit 11b42bb

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

spec/lib/importer_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,24 @@
128128
expect { importer.import_items! }.to raise_error(ArgumentError)
129129
expect(Item.count).to eq(count_before)
130130
end
131+
132+
it 'fails if an item does not have an image attribute' do
133+
importer.factories.first.attributes[:image] = nil
134+
stub_request(:head, thumbnail_uri).to_return(status: 200)
135+
136+
count_before = Item.count
137+
expect { importer.import_items! }.to raise_error(ArgumentError)
138+
expect(Item.count).to eq(count_before)
139+
end
140+
141+
it 'fails if an item does not have a thumbnail attribute' do
142+
importer.factories.first.attributes[:thumbnail] = nil
143+
stub_request(:head, image_uri).to_return(status: 200)
144+
145+
count_before = Item.count
146+
expect { importer.import_items! }.to raise_error(ArgumentError)
147+
expect(Item.count).to eq(count_before)
148+
end
131149
end
132150

133151
context 'without validation' do

0 commit comments

Comments
 (0)