拥有下一个工厂:
FactoryGirl.define do
factory :card do
bundle
number 4567
end
factory :bundle do
start_number 12345
cards_amount 10
after_create { |bundle| Factory(:card, :number => start_number, :bundle => bundle) }
end
end
所以,每个包都有一些卡片,f.i。捆绑2-5具有卡2,3,4,5,start_number = 2和cards_amount = 4
我想生成一个包含10张卡Factory(:bundle, :cards_amount => 10)
的捆绑包,但数字相同且未填写所需范围。
如何制作包含正确卡号的捆绑包?