[英]How to add the value of another field to an HTTParty field using Ruby
可以使用這個:將密碼生成的偽造內容添加到“ passoword_confirmation ”。 如果是這樣,語法是什么,嘗試各種方法並失敗..謝謝
“電子郵件”:Faker::Internet.email,“密碼”:Faker::number(6),“密碼確認”:
@@base_url = 'https://api-de-tarefas.herokuapp.com/users'
@@body =
{
"user": {
"email": Faker::Internet.email,
"password": Faker::number(6),
"password_confirmation": here I want to receive the password generated from Faker.
}
}.to_json
您可以通過在輸入@@body
塊之前將密碼保存到變量來保留密碼。
@@base_url = 'https://api-de-tarefas.herokuapp.com/users'
fake_password = Faker::number(6)
@@body =
{
"user": {
"email": Faker::Internet.email,
"password": fake_password,
"password_confirmation": fake_password
}
}.to_json
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.