Каждый раз, когда я создаю объект Factory, я получаю эту ошибку, когда factory задает свойство для этого объекта - в данном случае «name». Почему ???
businesses.rb
FactoryGirl.define do
factory :business do
factory :business_main do
name "Dave's Toys"
end
end
end
Таблица предприятий
Column | Type | Modifiers
----------------------+-----------------------------+---------------------------------------------------------
id | integer | not null default nextval('businesses_id_seq'::regclass)
name | character varying(255) |
address_line1 | character varying(255) |
address_line2 | character varying(255) |
city | character varying(255) |
state | character varying(255) |
zip | character varying(255) |
business_spec.rb
...
business = Factory(:business_main)
...
# Failure/Error: business = Factory(:business_main)
# NoMethodError: undefined method `name=' for #<Business:0x007fc991684590>
-
Using rails (3.1.3)
Using factory_girl (2.3.2)
Using factory_girl_rails (1.4.0)
Using rspec-core (2.7.1)
Using rspec-expectations (2.7.0)
Using rspec-mocks (2.7.0)
Using rspec (2.7.0)
Using rspec-rails (2.7.0)