Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20326 from hderms/dh/fix_task_bug
Fix rake method definition leaking onto Object
- Loading branch information
Showing
2 changed files
with
66 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
require "isolation/abstract_unit" | ||
require "active_support/core_ext/string/strip" | ||
|
||
module ApplicationTests | ||
module RakeTests | ||
class FrameworkTest < ActiveSupport::TestCase | ||
include ActiveSupport::Testing::Isolation | ||
|
||
def setup | ||
build_app | ||
boot_rails | ||
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 |