title: RSpec Test Suite Not Running After Rails 5.0.1 Upgrade
body: <p>We're upgrading a Rails application from 3.2 to 5.0. We got to 4.2 and had a test suite passing 100%, we're now at 5.0.1 and the test-suite is throwing an argument error.</p>
  
  <p>When running rake spec:models, the following error occurs:</p>
  
  <pre><code>An error occurred while loading rails_helper.
  Failure/Error: require File.expand_path("../config/environment", __dir__)
  
  ArgumentError:
    wrong number of arguments (given 0, expected 2..3)
  </code></pre>
  
  <p><strong>Ruby V 2.5.1</strong>
  <strong>RSpec V 3.8</strong></p>
  
  <p>Running rake db:migrate task in development environment completes, however..</p>
  
  <p>After running db:migrate in test environment, the following error(s) occur:</p>
  
  <pre><code>ArgumentError: wrong number of arguments (given 0, expected 2..3)
  /home/vagrant/rtest/config/initializers/load_rtest_config.rb:5:in `test'
  /home/vagrant/rtest/config/initializers/load_rtest_config.rb:5:in `&lt;top 
  (required)&gt;'
  /home/vagrant/rtest/config/environment.rb:8:in `&lt;top (required)&gt;'
  /home/vagrant/rtest/bin/rails:4:in `require'
  /home/vagrant/rtest/bin/rails:4:in `&lt;main&gt;'
  Tasks: TOP =&gt; db:migrate =&gt; environment
  (See full trace by running task with --trace)
  </code></pre>
  
  <p><strong>envrionment.rb:</strong></p>
  
  <pre><code># Load the rails application
  # require File.expand_path('../application', __FILE__) # RAILS 4.2
  require_relative 'application'
  
  
  # Initialize the rails application
  # Changes for rtest upgrade
  Rails.application.initialize!
  </code></pre>
  
  <p><strong>load_rtest_config.rb:</strong></p>
  
  <pre><code>require 'ostruct'
  require 'yaml'
  
  config = OpenStruct.new(YAML.load_file("#{Rails.root}/config/rtest.yml"))
  ::RTestConfig = OpenStruct.new(config.send(Rails.env))
  
  ::SummaryConfig = OpenStruct.new(YAML.load_file("# 
  {Rails.root}/config/summary.yml"))
  
  ::LDAPConfig = OpenStruct.new(YAML.load_file("# 
  {Rails.root}/config/ldap.yml"))
  </code></pre>
  
  <p><strong>Relevant gems:</strong></p>
  
  <pre><code>  gem 'rails-controller-testing'
  
  group :test do
    gem 'factory_bot_rails', :require =&gt; false
    gem 'capybara'
    gem 'guard-rspec'
    gem 'guard-spork'
    gem 'shoulda'
    gem 'rspec-its'
    gem 'rubocop-rspec'
    gem 'rspec-rails'
    gem 'rails-controller-testing'
  
    #Rails 5 Upgrade
    # gem 'shoulda-matchers'
  end
  </code></pre>
  
  <p><strong>rails_helper.rb</strong></p>
  
  <pre><code>require 'rubygems'
  # require 'spork'
  require 'database_cleaner'
  require 'rspec/its'
  
  # ActiveRecord::Migration.check_pending!
  # ActiveRecord::Migration.maintain_test_schema!
  
  
  require 'spec_helper'
  require File.expand_path("../config/environment", __dir__)
  require 'rspec/rails'
  require 'rspec/autorun'
  require 'factory_bot_rails'
  require 'capybara/rspec'
  require 'authlogic/test_case'
    ENV["RAILS_ENV"] ||= 'test'
  
    Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
  
  
    RSpec.configure do |config|
      config.expose_current_running_example_as :example
      config.use_transactional_fixtures = true
      config.include FactoryBot::Syntax::Methods
      config.include Shoulda::Matchers::ActiveModel, type: :model
      config.include Shoulda::Matchers::ActiveRecord, type: :model
      config.include Devise::Test::ControllerHelpers, :type =&gt; :controller
      config.include LoginMacros, :type =&gt; :controller
      config.include LoginMacrosRequest, :type =&gt; :request
      config.after(:each) { Warden.test_reset! }
      end
  
    puts "Reloading controllers and models"
    Dir["#{Rails.root}/app/controllers//*.rb"].each do |controller|
      load controller
    end
    Dir["#{Rails.root}/app/models//*.rb"].each do |model|
      load model
    end
    puts "Done"
  
    FactoryBot.reload
    Dir[Rails.root.join("spec/support/**/*.rb")].each do |f|
      require f
    end
  </code></pre>
  
  <p><strong>edit:</strong> Apologies if the question isn't clear, this is my first question, thanks.</p>