0
建築協會我有這樣的工廠:錯誤與FactoryGirl
FactoryGirl.define do
factory :asset_size do
sequence(:name) { |n| "AssetSize#{n}" }
after_create do |as|
FactoryGirl.create(:midpoint, :asset_size => as)
FactoryGirl.create(:midpoint, :asset_size => as, :grade => 18, :yearly_wage => 25000.00)
end
end
end
但不斷收到此錯誤:
AssetSize(#70166742384960) expected, got #<Class:0x007fa1eddef738>(#70166728637340) (ActiveRecord::AssociationTypeMismatch) ./spec/factories/asset_size_factory.rb:7:in `block (3 levels) in './features/step_definitions/role_authorization_steps.rb:2:in `/^a basic balanced results employee$/'./features/role_authorization.feature:4:in `Given a basic balanced results employee'
after_create do |as|
FactoryGirl.create(:midpoint, :asset_size => as)
FactoryGirl.create(:midpoint, :asset_size => as, :grade => 18, :yearly_wage => 25000.00)
我underatand的錯誤,但我不明白我的語法是怎麼關閉。
你是對的!謝謝你太多了! – Jarrett
老兄,我一直在這一週都在調試垃圾,現在幫我解決我的問題! ;-)很高興它的工作。 – pjammer