2010-06-10 13:37:51 -04:00
|
|
|
require 'spec_helper'
|
2009-04-11 11:27:23 -04:00
|
|
|
|
2010-06-24 09:45:57 -04:00
|
|
|
describe FactoryGirl::Attribute do
|
2011-08-13 01:03:12 -04:00
|
|
|
let(:name) { "user" }
|
2011-10-07 18:19:27 -04:00
|
|
|
subject { FactoryGirl::Attribute.new(name, false) }
|
2009-04-11 11:27:23 -04:00
|
|
|
|
2011-08-13 01:03:12 -04:00
|
|
|
its(:name) { should == name.to_sym }
|
|
|
|
it { should_not be_association }
|
2011-05-19 10:56:45 -04:00
|
|
|
|
2011-08-13 01:03:12 -04:00
|
|
|
it "raises an error when defining an attribute writer" do
|
2009-04-17 04:58:35 -04:00
|
|
|
error_message = %{factory_girl uses 'f.test value' syntax rather than 'f.test = value'}
|
2011-08-13 01:03:12 -04:00
|
|
|
expect {
|
2011-10-07 18:19:27 -04:00
|
|
|
FactoryGirl::Attribute.new('test=', false)
|
2011-08-13 01:03:12 -04:00
|
|
|
}.to raise_error(FactoryGirl::AttributeDefinitionError, error_message)
|
2009-04-11 11:27:23 -04:00
|
|
|
end
|
|
|
|
end
|