【问题标题】:Can't use devise IntegrationHelpers on Rail's minitest不能在 Rail 的 minitest 上使用设计 IntegrationHelpers
【发布时间】:2017-01-12 14:22:21
【问题描述】:

我正在使用'devise'、'~> 3.5'、'>= 3.5.6'。

我的controller test 工作,但我无法让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

【问题讨论】:

    标签: ruby-on-rails ruby devise minitest


    【解决方案1】:

    我似乎在使用旧版本。我刚刚更新到 4.1.1

    gem 'devise', '~> 4.1', '>= 4.1.1'
    

    【讨论】:

      猜你喜欢
      • 2017-01-18
      • 1970-01-01
      • 2022-01-26
      • 2021-07-06
      • 1970-01-01
      • 2013-12-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-13
      相关资源
      最近更新 更多