测试条带框架需要打开Javascript,但是当我在it方法中发送it时,其他组件(如visit、fill_in )就不再像以前那样工作了。
这是我的代码:
def sign_up(subdomain)
visit root_url(subdomain: false)
visit new_account_path
fill_in 'Name', with: 'Ryan'
fill_in 'Email', with: 'test@test.com'
fill_in 'Password', with: 'password'
fill_in 'Password confirmation', with: 'password'
fill_in 'Subdomain', with: subdomain
click_button 'Create Account'
end在sign_up方法中,visit new_account_path在js: true之前工作,但现在没有了。
我使用以下方法来转换js: true:
it 'shows the user can upgrade his account with valid card number, expiration and CVC', js: true do
fill_in "card_number", :with => "4242424242424242"
fill_in "card_expiry_month", :with => "05"
fill_in "card_expiry_year", :with => "2015"
fill_in "card_cvc", :with => "123"
click_button 'Upgrade Your Account'
expect(page).to have_content "Update Your Payment Information"
end我已经寻找了很长时间的解决方案,但到目前为止还无法解决这个问题。
发布于 2015-03-03 03:28:42
根据您的评论,您将从stripe的API:Stripe::InvalidRequestError中得到一个错误。
根据他们的API (https://stripe.com/docs/api#errors):
当您的请求具有无效的参数时,会出现无效的请求错误。
我敢打赌,你向斯特里普提出的要求,实际上是有问题的,而不是卡皮巴拉(?)你写的规范。
我写了一篇关于用RSpec和Capybara为Stripe编写验收测试的博客文章。你可以在这里看
https://stackoverflow.com/questions/28678030
复制相似问题