我有这个工厂:
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)
我理解错误,但我不明白我的语法是如何关闭的。