我正在尝试像FactoryGirl对象一样创建这个嵌套的哈希结构,以便我可以调用FactoryGirl.attributes_for(:my_object)
amount: total,
payment_method_nonce: params[:payment_method_nonce],
device_data: params[:device_data],
customer: {
first_name: params[:first_name],
},
billing: {
first_name: params[:first_name],
last_name: params[:last_name],
}
到目前为止我已经
了FactoryGirl.define do
factory :my_object do
amount nil
payment_method_nonce '132465'
device_data 'device_data'
customer {
first_name 'Richard'
}
billing {
first_name 'Richard'
last_name 'Lewis'
}
end
end
我收到了语法错误,似乎无法正确使用