使用 rspec 与 Webrat 而不是 Capybara

发布于 2024-09-28 17:21:36 字数 143 浏览 1 评论 0原文

我一直在 webrat 中使用 rspec 并决定添加 cucumber 进行高级测试。

在使用 capybara 安装 cucumber 后,出于某种原因,rspec 也转而使用它。

有没有办法告诉 rspec 继续使用 webrat ?

I have been using rspec with webrat and decided to add cucumber for high level tests.

After installing cucumber with capybara, for some reason rspec also switched to using it.

Is there a way to tell rspec to continue using webrat ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

橘亓 2024-10-05 17:21:36

确保 Gemfile 中同时包含 webrat 和 capybara,并将以下内容添加到 /spec/spec_helper.rb:

require "webrat"
Webrat.configure do |config|
    config.mode = :rails
end

我刚刚切换到 capybara,但我的视图规范停止工作,因为 capybara 没有“have_selector”。我猜你也遇到过类似的问题,好吧,现在它(希望)已经解决了。

Make sure you have both webrat and capybara in your Gemfile, and add the following to your /spec/spec_helper.rb:

require "webrat"
Webrat.configure do |config|
    config.mode = :rails
end

I've just switched to capybara, but my view specs stopped working because capybara has no 'have_selector'. Guess you had a similar problem, well, now it's (hopefully) solved.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文