title: Rails 5.1/Devise 4.4 - Testing: undefined method `setup' for Object:Class (NoMethodError)
body: <p>I am running into a "undefined method `setup' for Object:Class (NoMethodError)" when testing with Rails. I am getting this error when running any of my tests.</p>
  
  <p>I am using the test setup from the Ruby on Rails Tutorial and in addition have included Devise::Test::IntegrationHelpers (for integration tests) and Devise::Test::ControllerHelpers (for controller tests) in my test files. </p>
  
  <p>This is the error I am getting:
  .rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/devise4.4.3/lib/devise/test/controller_helpers.rb:30:in <code>block in &lt;module:ControllerHelpers&gt;': undefined method</code>setup' for Object:Class (NoMethodError)</p>
  
  <p>This is the line from the controller_helpers file the error refers to:</p>
  
  <pre><code>module Devise
     module Test
  
        module ControllerHelpers
          extend ActiveSupport::Concern
  
          included do
             setup :setup_controller_for_warden, :warden
          end
           .
           .
           .
  </code></pre>
  
  <p>These are my test gems:</p>
  
  <pre><code>group :test do
     gem 'rails-controller-testing', '1.0.2'
     gem 'minitest-reporters',       '1.1.14'
     gem 'guard',                    '2.13.0'
     gem 'guard-minitest',           '2.4.4'
  end
  </code></pre>
  
  <p>This is my test_helper.rb file:</p>
  
  <pre><code>ENV['RAILS_ENV'] ||= 'test'
  require File.expand_path('../../config/environment', __FILE__)
  require 'rails/test_help'
  require "minitest/reporters"
  Minitest::Reporters.use!
  
  class ActiveSupport::TestCase
      fixtures :all 
  end
  </code></pre>
  
  <p>This is one of my tests:</p>
  
  <pre><code>require 'test_helper'
  
  class UsersControllerTest &lt; ActionController::TestCase
    include Devise::Test::ControllerHelpers
  
   setup do
      @user = users(:one)
   end
  
   test "should get index" do
      get users_url
      assert_response :success
   end
  
   test "should get new" do
     get new_user_url
     assert_response :success
   end
    .
    .
    .
  end
  </code></pre>
  
  <p>Any help with this issue would be appreciated. Thank you.</p>