首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >测试Stripe使用js: true,但它使其他组件不正确地工作。

测试Stripe使用js: true,但它使其他组件不正确地工作。
EN

Stack Overflow用户
提问于 2015-02-23 16:08:46
回答 1查看 145关注 0票数 1

测试条带框架需要打开Javascript,但是当我在it方法中发送it时,其他组件(如visitfill_in )就不再像以前那样工作了。

这是我的代码:

代码语言:javascript
复制
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_pathjs: true之前工作,但现在没有了。

我使用以下方法来转换js: true

代码语言:javascript
复制
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

我已经寻找了很长时间的解决方案,但到目前为止还无法解决这个问题。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-03-03 03:28:42

根据您的评论,您将从stripe的API:Stripe::InvalidRequestError中得到一个错误。

根据他们的API (https://stripe.com/docs/api#errors):

当您的请求具有无效的参数时,会出现无效的请求错误。

我敢打赌,你向斯特里普提出的要求,实际上是有问题的,而不是卡皮巴拉(?)你写的规范。

我写了一篇关于用RSpec和Capybara为Stripe编写验收测试的博客文章。你可以在这里看

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28678030

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档