如果method和self.method是保留字,如何创建FactoryGirl实例?
FactoryGirl.define do
factory :payment do
method 'paypal' # self.method doesn't work as well
amount 12.95
end
end
答案 0 :(得分:0)
您需要add_attribute
方法,但@ user3946015提到的语法似乎不适用于FactoryGirl 4.5.0。而是尝试:
add_attribute(:method) { 'paypal' }