aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/configuration/base_test.rb
blob: 6e2b6181605c840b79bd9c58460359ceb7f78dd5 (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
28
29
30
31
32
33
34
35
36
37
38
39
require 'isolation/abstract_unit'
require 'rack/test'
require 'env_helpers'

module ApplicationTests
  module ConfigurationTests
    class BaseTest < ActiveSupport::TestCase
      include ActiveSupport::Testing::Isolation

      def setup
        build_app
        boot_rails
        FileUtils.rm_rf("#{app_path}/config/environments")
      end

      def teardown
        teardown_app
        FileUtils.rm_rf(new_app) if File.directory?(new_app)
      end

      private
        def new_app
          File.expand_path("#{app_path}/../new_app")
        end

        def copy_app
          FileUtils.cp_r(app_path, new_app)
        end

        def app
          @app ||= Rails.application
        end

        def require_environment
          require "#{app_path}/config/environment"
        end
    end
  end
end