Fix model tests for alternate names.

This commit is contained in:
Miles Gould committed 2014-10-18 17:30:22 +01:00
1 parent c7c85aaa66
commit dc2cf5275c
1 file changed
+6 -8
+6 -8
View File
@@ -1,24 +1,22 @@
require 'spec_helper'
describe AlternateName do
before (:each) do
@an = FactoryGirl.create(:alternate_tomato)
end
let(:an) { FactoryGirl.create(:alternate_eggplant) }
it 'should save a basic alternate name' do
@an.save.should be_true
expect(an.save).to be_true
end
it 'should be possible to add multiple alternate names to a crop' do
crop = @an.crop
crop = an.crop
an2 = AlternateName.create(
:name => "really alternative tomato",
:crop_id => crop.id,
:creator_id => @an.creator.id
:creator_id => an.creator.id
)
crop.alternate_names << an2
crop.alternate_names.should include @an
crop.alternate_names.should include an2
expect(crop.alternate_names).to include an
expect(crop.alternate_names).to include an2
end
end