Displaying 1 result from an estimated 1 matches for "currency_id".
Did you mean:
currency_df
2011 Sep 07
6
FactoryGirl doesnt produce unique names?!
..."Country #{n}"
end
Factory.define :country do |c|
c.name Factory.next(:country_name)
c.nationality "Foo nationality"
c.association :currency
end
And the model:
class Country < ActiveRecord::Base
attr_accessible :currency, :code
belongs_to :currency
validates :currency_id, :presence => true
validates :name, :presence => true, :uniqueness => true
end
When I run rspec I get following failure:
Failures:
1) Country should create a new instance given valid attributes
Failure/Error: Factory(:country)
ActiveRecord::RecordInvalid:
Validation...