1
我只需要像信用卡和地址等屬性的散列。 例子:工廠女孩:你如何製造一個與模型無關的工廠?
Factory.define :credit_card, :class => Object do |c|
c.first_name "Alice"
c.last_name "Liddel"
c.month "May"
c.year { Time.now.year + 1 }
c.number "1234567812345678"
c.type "Visa"
c.verification_value "123"
end
明顯,對象沒有任何屬性,我沒有credit_cord對象......我只是需要一個標準信用卡骨架。
爲了統一重複數據的生成。工廠(:what_im_making,attrs) – NullVoxPopuli