mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-10-24 15:58:22 -04:00
Fix model tests for alternate names.
This commit is contained in:
1 parent
c7c85aaa66
commit
dc2cf5275c
1 file changed
+6
-8
@@ -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
|
||||
Reference in new issue
Block a user