У меня проблема с factory_girl. Вот ошибка с rspec.
"Ошибка/ошибка: клиент = Factory(:customer, :name => nil) NoMethodError: неопределенный метод `category1_id=' для #Customer:0x4175418"
Вот код rspec:
describe "data integrity" do
it "should return error with no name" do
customer = Factory(:customer, :name => nil)
customer.errors[:name].should_not be_empty
customer.should_not be_valid
end
it "should take a good name" do
customer = Factory(:customer, :name => "good customer name")
customer.errors[:name].should be_empty
end
end
category1_id — это столбец в таблице клиентов. Вот заказчик.рб
class Customer < ActiveRecord::Base
validates :name, :presence => true
end
Определение Factory(:customer)
Factory.define :customer do |c|
c.name "test customer"
c.email "[email protected]"
c.phone "12345678"
c.cell "1234567890"
c.active 1
c.category1_id 2
c.short_name "test"
end
Есть предположения? Благодарю.
category1_id
в вашей таблицеcustomer
- person NARKOZ   schedule 12.09.2011