diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/rake/test_rake_application.rb | 24 | ||||
-rw-r--r-- | test/rake/test_rake_application_options.rb | 4 | ||||
-rw-r--r-- | test/rake/test_rake_test_task.rb | 19 |
3 files changed, 26 insertions, 21 deletions
diff --git a/test/rake/test_rake_application.rb b/test/rake/test_rake_application.rb index 19e5005989..c010889176 100644 --- a/test/rake/test_rake_application.rb +++ b/test/rake/test_rake_application.rb @@ -10,9 +10,9 @@ class TestRakeApplication < Rake::TestCase end def setup_command_line(*options) - @app.argv.clear + ARGV.clear options.each do |option| - @app.argv << option + ARGV << option end end @@ -268,7 +268,7 @@ class TestRakeApplication < Rake::TestCase end def test_load_rakefile_not_found - @app.argv.clear + ARGV.clear Dir.chdir @tempdir ENV['RAKE_SYSTEM'] = 'not_exist' @@ -370,7 +370,7 @@ class TestRakeApplication < Rake::TestCase # HACK no assertions end - def test_handle_options_should_strip_options_from_argv + def test_handle_options_should_not_strip_options_from_argv assert !@app.options.trace valid_option = '--trace' @@ -378,7 +378,7 @@ class TestRakeApplication < Rake::TestCase @app.handle_options - assert !@app.argv.include?(valid_option) + assert ARGV.include?(valid_option) assert @app.options.trace end @@ -406,14 +406,14 @@ class TestRakeApplication < Rake::TestCase setup_command_line("--trace", "sometask") @app.handle_options - assert @app.argv.include?("sometask") + assert ARGV.include?("sometask") assert @app.options.trace end def test_good_run ran = false - @app.argv << '--rakelib=""' + ARGV << '--rakelib=""' @app.options.silent = true @@ -468,7 +468,7 @@ class TestRakeApplication < Rake::TestCase } assert_match(/see full trace/i, err) ensure - @app.argv.clear + ARGV.clear end def test_bad_run_with_trace @@ -479,7 +479,7 @@ class TestRakeApplication < Rake::TestCase } refute_match(/see full trace/i, err) ensure - @app.argv.clear + ARGV.clear end def test_bad_run_with_backtrace @@ -492,7 +492,7 @@ class TestRakeApplication < Rake::TestCase } refute_match(/see full trace/, err) ensure - @app.argv.clear + ARGV.clear end CustomError = Class.new(RuntimeError) @@ -549,7 +549,7 @@ class TestRakeApplication < Rake::TestCase end assert_match(/Secondary Error/, err) ensure - @app.argv.clear + ARGV.clear end def test_run_with_bad_options @@ -559,7 +559,7 @@ class TestRakeApplication < Rake::TestCase capture_io { @app.run } } ensure - @app.argv.clear + ARGV.clear end def test_standard_exception_handling_invalid_option diff --git a/test/rake/test_rake_application_options.rb b/test/rake/test_rake_application_options.rb index a9ae4d9c00..37adfacd7d 100644 --- a/test/rake/test_rake_application_options.rb +++ b/test/rake/test_rake_application_options.rb @@ -457,8 +457,8 @@ class TestRakeApplicationOptions < Rake::TestCase throw :system_exit, :exit end @app.instance_eval do - handle_options - collect_command_line_tasks + args = handle_options + collect_command_line_tasks(args) end @tasks = @app.top_level_tasks @app.options diff --git a/test/rake/test_rake_test_task.rb b/test/rake/test_rake_test_task.rb index 80fe9a28b4..5c4be797c6 100644 --- a/test/rake/test_rake_test_task.rb +++ b/test/rake/test_rake_test_task.rb @@ -97,17 +97,22 @@ class TestRakeTestTask < Rake::TestCase end def test_run_code_rake_default_gem + skip 'this ruby does not have default gems' unless + Gem::Specification.method_defined? :default_specifications_dir + default_spec = Gem::Specification.new 'rake', 0 default_spec.loaded_from = File.join Gem::Specification.default_specifications_dir, 'rake-0.gemspec' - rake, Gem.loaded_specs['rake'] = Gem.loaded_specs['rake'], default_spec + begin + rake, Gem.loaded_specs['rake'] = Gem.loaded_specs['rake'], default_spec - test_task = Rake::TestTask.new do |t| - t.loader = :rake - end + test_task = Rake::TestTask.new do |t| + t.loader = :rake + end - assert_match(/\A(-I".*?" *)* ".*?"\Z/, test_task.run_code) - ensure - Gem.loaded_specs['rake'] = rake + assert_match(/\A(-I".*?" *)* ".*?"\Z/, test_task.run_code) + ensure + Gem.loaded_specs['rake'] = rake + end end def test_run_code_testrb_ruby_1_8_2 |