aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/rake/framework_test.rb
blob: ec476addf43c4cbf45ee6d63e3b2e5ba0974a82f (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
40
41
42
43
44
45
46
47
# frozen_string_literal: true
require "isolation/abstract_unit"

module ApplicationTests
  module RakeTests
    class FrameworkTest < ActiveSupport::TestCase
      include ActiveSupport::Testing::Isolation

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

      def teardown
        teardown_app
      end

      def load_tasks
        require "rake"
        require "rdoc/task"
        require "rake/testtask"

        Rails.application.load_tasks
      end

      test "requiring the rake task should not define method .app_generator on Object" do
        require "#{app_path}/config/environment"

        load_tasks

        assert_raise NameError do
          Object.method(:app_generator)
        end
      end

      test "requiring the rake task should not define method .invoke_from_app_generator on Object" do
        require "#{app_path}/config/environment"

        load_tasks

        assert_raise NameError do
          Object.method(:invoke_from_app_generator)
        end
      end
    end
  end
end