Sha256: 33bdec9386adb028234abab5a0331460565ba21009d2d885e86bfb4cdd519a5d

Contents?: true

Size: 1.32 KB

Versions: 21

Compression:

Stored size: 1.32 KB

Contents

# frozen_string_literal: true

# :enddoc:

# Make double-sure the RAILS_ENV is not set to production,
# so fixtures aren't loaded into that environment
abort("Abort testing: Your Rails environment is running in production mode!") if Rails.env.production?

require "active_support/test_case"
require "rails/generators/test_case"
require "active_support/testing/autorun"

require "rails/testing/maintain_test_schema"

if defined?(ActiveRecord::Base)
  require "active_record/testing/query_assertions"
  ActiveSupport.on_load(:active_support_test_case) do
    include ActiveRecord::TestDatabases
    include ActiveRecord::TestFixtures
    include ActiveRecord::Assertions::QueryAssertions

    self.fixture_paths << "#{Rails.root}/test/fixtures/"
    self.file_fixture_path = "#{Rails.root}/test/fixtures/files"
  end

  ActiveSupport.on_load(:action_dispatch_integration_test) do
    self.fixture_paths += ActiveSupport::TestCase.fixture_paths
  end
else
  ActiveSupport.on_load(:active_support_test_case) do
    self.file_fixture_path = "#{Rails.root}/test/fixtures/files"
  end
end

ActiveSupport.on_load(:action_controller_test_case) do
  def before_setup
    @routes = Rails.application.routes
    super
  end
end

ActiveSupport.on_load(:action_dispatch_integration_test) do
  def before_setup
    @routes = Rails.application.routes
    super
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
railties-8.0.1 lib/rails/test_help.rb
railties-8.0.0.1 lib/rails/test_help.rb
railties-7.2.2.1 lib/rails/test_help.rb
railties-8.0.0 lib/rails/test_help.rb
railties-7.2.2 lib/rails/test_help.rb
railties-8.0.0.rc2 lib/rails/test_help.rb
railties-7.2.1.2 lib/rails/test_help.rb
railties-8.0.0.rc1 lib/rails/test_help.rb
railties-7.2.1.1 lib/rails/test_help.rb
railties-8.0.0.beta1 lib/rails/test_help.rb
omg-railties-8.0.0.alpha9 lib/rails/test_help.rb
omg-railties-8.0.0.alpha8 lib/rails/test_help.rb
omg-railties-8.0.0.alpha7 lib/rails/test_help.rb
omg-railties-8.0.0.alpha4 lib/rails/test_help.rb
omg-railties-8.0.0.alpha3 lib/rails/test_help.rb
railties-7.2.1 lib/rails/test_help.rb
railties-7.2.0 lib/rails/test_help.rb
railties-7.2.0.rc1 lib/rails/test_help.rb
railties-7.2.0.beta3 lib/rails/test_help.rb
railties-7.2.0.beta2 lib/rails/test_help.rb