誰かが私にこれを助けることを願っています。私は検索しましたが、実際の解決策は見つかりませんでした。はそのようなファイルを読み込めません - capybara/minitest
私はアプリのテストを書き始めました。私の統合テストはうまくいきましたが、TDDを動かすのはそれほど多くなかったので、今私はintegration
テストの代わりに使うはずのアプリのすべてのレイヤーを広範にテストする時間がないので、system
私はブラウザのように完全なフローをテストすることができます。
Rails 5.1.2
Gemfile
gem 'minitest-rails'
gem 'minitest-rails-capybara'
gem 'capybara'
test_helper.rb(その後、他の二つの両方の組み合わせで試した異なるバリエーション、ちょうどカピバラ)
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
application_system_test_case.rb
require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
end
register_logins.rb
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)
を実行している完全なトレースは、この追加:
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)>'
とactive_supportのdepende上に行きますncies。 'minitest-rails-capybara'
おかげ
と、その後group :development, :test do
gem 'minitest-rails'
gem 'minitest-capybara'
gem 'capybara'
end
:私は宝石を試してみました
require "capybara/rails"
require "minitest/rails"
require "minitest/rails/capybara"
:
がtest_helper.rb
に1つ、2つ、3つの追加:私が試してみました何
あなたはどのバージョンのCapybaraを使用していますか? –
capybara(2.6.2)@ThomasWalpole –
Rails 5.1のシステムテストには少なくとも2.13.0が必要です(最新の(2.14。4)、minitest-capybaraやminitest-railsの宝石はもう必要ありません。 –