Files
growstuff/spec/models/scientific_name_spec.rb
Logan Gingerich 10a8df47a9 Factorygirl to factorybot - fixes #1413 (#1425)
* FactoryGirl Changed to FactoryBot

file fix

changes based on comments received

Bundle Update on 2017-10-29

style update to align hash literal

added package-lock

* indentation fixes with rubocop

* name added to contributors
2017-11-01 15:03:31 +00:00

30 lines
695 B
Ruby

require 'rails_helper'
describe ScientificName do
context 'all fields present' do
let(:sn) { FactoryBot.create(:zea_mays) }
it 'should save a basic scientific name' do
sn.save.should be(true)
end
it 'should be fetchable from the database' do
sn.save
@sn2 = ScientificName.find_by(name: 'Zea mays')
@sn2.crop.name.should == 'maize'
end
it 'has a creator' do
sn.save
sn.creator.should be_an_instance_of Member
end
end
context 'invalid data' do
it 'should not save a scientific name without a name' do
sn = ScientificName.new
expect { sn.save! }.to raise_error ActiveRecord::RecordInvalid
end
end
end