2017-08-14 13:08:09 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-05-27 19:48:24 -04:00
|
|
|
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
|
2016-08-06 13:16:09 -04:00
|
|
|
require "rake"
|
|
|
|
require "rdoc/task"
|
|
|
|
require "rake/testtask"
|
2015-05-27 19:48:24 -04:00
|
|
|
|
|
|
|
Rails.application.load_tasks
|
|
|
|
end
|
|
|
|
|
2016-08-06 13:16:09 -04:00
|
|
|
test "requiring the rake task should not define method .app_generator on Object" do
|
2015-05-27 19:48:24 -04:00
|
|
|
require "#{app_path}/config/environment"
|
2015-05-27 21:18:00 -04:00
|
|
|
|
2015-05-27 19:48:24 -04:00
|
|
|
load_tasks
|
2015-05-27 21:18:00 -04:00
|
|
|
|
2015-05-27 19:48:24 -04:00
|
|
|
assert_raise NameError do
|
|
|
|
Object.method(:app_generator)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-08-06 13:16:09 -04:00
|
|
|
test "requiring the rake task should not define method .invoke_from_app_generator on Object" do
|
2015-05-27 19:48:24 -04:00
|
|
|
require "#{app_path}/config/environment"
|
2015-05-27 21:18:00 -04:00
|
|
|
|
2015-05-27 19:48:24 -04:00
|
|
|
load_tasks
|
|
|
|
|
|
|
|
assert_raise NameError do
|
|
|
|
Object.method(:invoke_from_app_generator)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|