无法在 Rail 的最小测试中使用设计 IntegrationHelpers
Can't use devise IntegrationHelpers on Rail's minitest
我正在使用“devise”、“~> 3.5”、“>= 3.5.6”。
我的 controller test work, but I can't get the integration test 到 运行
test_helper.rb
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require "minitest/rails/capybara"
require "mocha/mini_test"
require "minitest/reporters"
require 'shoulda/context'
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new # spec-like progress
include Devise::TestHelpers
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
include FactoryGirl::Syntax::Methods
fixtures :all
end
夹具:
default_user:
name: "User"
email: "example@example.org"
encrypted_password: "exampleexample"
示例测试文件:
class PostsTests < ActionDispatch::IntegrationTest
include Devise::Test::IntegrationHelpers
test 'authenticated users can see posts' do
sign_in users(:default_user)
end
end
错误:
NameError: uninitialized constant Devise::Test
我似乎在使用旧版本。我刚更新到 4.1.1
gem 'devise', '~> 4.1', '>= 4.1.1'
我正在使用“devise”、“~> 3.5”、“>= 3.5.6”。
我的 controller test work, but I can't get the integration test 到 运行
test_helper.rb
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require "minitest/rails/capybara"
require "mocha/mini_test"
require "minitest/reporters"
require 'shoulda/context'
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new # spec-like progress
include Devise::TestHelpers
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
include FactoryGirl::Syntax::Methods
fixtures :all
end
夹具:
default_user:
name: "User"
email: "example@example.org"
encrypted_password: "exampleexample"
示例测试文件:
class PostsTests < ActionDispatch::IntegrationTest
include Devise::Test::IntegrationHelpers
test 'authenticated users can see posts' do
sign_in users(:default_user)
end
end
错误:
NameError: uninitialized constant Devise::Test
我似乎在使用旧版本。我刚更新到 4.1.1
gem 'devise', '~> 4.1', '>= 4.1.1'