aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/test_unit/railtie.rb
blob: f1965f3b1215e529020f6b4840eb2f7f6b4ea9c2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require_relative "line_filtering"

if defined?(Rake.application) && Rake.application.top_level_tasks.grep(/^(default$|test(:|$))/).any?
  ENV["RAILS_ENV"] ||= Rake.application.options.show_tasks ? "development" : "test"
end

module Rails
  class TestUnitRailtie < Rails::Railtie
    config.app_generators do |c|
      c.test_framework :test_unit, fixture: true,
                                   fixture_replacement: nil

      c.integration_tool :test_unit
      c.system_tests :test_unit
    end

    initializer "test_unit.line_filtering" do
      ActiveSupport.on_load(:active_support_test_case) {
        ActiveSupport::TestCase.extend Rails::LineFiltering
      }
    end

    rake_tasks do
      load "rails/test_unit/testing.rake"
    end
  end
end