[英]cannot load such file — capybara/minitest
hope somebody can help me with this. 希望有人可以帮助我。 I did search but haven't found any working solution.
我确实进行了搜索,但没有找到任何有效的解决方案。
I've started writing test for an app. 我已经开始为应用编写测试。 My integration tests run fine, but then I decided that since I'm not that much of TDD driven and since I don't have that much time right now to extensively test all layers of the app that I should use instead of
integration
tests system
tests, because they allow me to test the full flow as if in a browser. 我的集成测试运行良好,但是后来我决定,因为我受TDD的驱动不是那么多,并且由于我现在没有太多时间来广泛测试应代替
integration
测试system
使用的应用程序的所有层测试,因为它们使我可以像在浏览器中一样测试整个流程。
Rails 5.1.2
Gemfile
(tried different variations, just capybara, then with combinations of both the other two) Gemfile
(尝试了不同的变体,只是水豚,然后结合了其他两个)
gem 'minitest-rails'
gem 'minitest-rails-capybara'
gem 'capybara'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
EMPTY_NEW_USER = {
email: '',
first_name: '',
last_name: '',
username: '',
password: ''
}
EXISTING_USER = {
email: '****',
first_name: 'John',
last_name: 'Doe',
username: '',
password: 'testingpass',
password_confirmation: 'testingpass'
}
# Add more helper methods to be used by all tests here...
end
require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
end
require "application_system_test_case"
class RegisterLoginsTest < ApplicationSystemTestCase
test 'full login flow' do
visit root_url
assert_response :success
find('.email_link').click
end
end
rake test:system
LoadError: cannot load such file -- capybara/minitest
/Users/mnussbaumer/code/dvouch/test/application_system_test_case.rb:3:in `<top (required)>'
/Users/mnussbaumer/code/dvouch/test/system/register_logins_test.rb:1:in `<top (required)>'
Tasks: TOP => test:system
(See full trace by running task with --trace)
The full trace adds this: 完整的跟踪将添加以下内容:
LoadError: cannot load such file -- capybara/minitest
/Users/mnussbaumer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `require'
/Users/mnussbaumer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `block in require'
/Users/mnussbaumer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:258:in `load_dependency'
/Users/mnussbaumer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `require'
/Users/mnussbaumer/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-5.1.2/lib/action_dispatch/system_test_case.rb:2:in `<top (required)>'
/Users/mnussbaumer/code/dvouch/test/application_system_test_case.rb:3:in `<top (required)>'
and goes on on active_support dependencies. 并继续进行active_support依赖性。
What I have tried: 我尝试过的
Adding one, two and three to test_helper.rb
: 在
test_helper.rb
添加一,二和三:
require "capybara/rails"
require "minitest/rails"
require "minitest/rails/capybara"
I tried with gems: 我尝试了宝石:
group :development, :test do
gem 'minitest-rails'
gem 'minitest-capybara'
gem 'capybara'
end
then with 'minitest-rails-capybara'
然后用
'minitest-rails-capybara'
Thanks 谢谢
The file capybara/minitest
was added to Capybara in version 2.13.0, which is the minimum version Rails requires for its system tests since Rails 5.1.0. 文件
capybara/minitest
已在版本2.13.0中添加到capybara/minitest
,这是Rails自Rails 5.1.0起进行系统测试所需的最低版本。 Upgrade to the latest version of Capybara (2.14.4) and there should be no need for the minitest-capybara
or minitest-rails
gems. 升级到最新版本的水豚(2.14.4),就不需要使用
minitest-capybara
minitest-rails
或minitest-rails
宝石。 You will need to also add the 'selenium-webdriver' gem to your test group. 您还需要将“ selenium-webdriver” gem添加到测试组。
Additionally the assert_response :success
line is't valid in Capybara tests because the HTTP response code from the browser Capybara is using isn't generally available. 另外,
assert_response :success
行在assert_response :success
测试中无效,因为来自assert_response :success
使用的浏览器的HTTP响应代码通常不可用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.