From 55bfef22641a11a8447e8cda84aab2d7f96bdbf1 Mon Sep 17 00:00:00 2001 From: "Mark D. Blackwell" Date: Fri, 29 Jul 2016 17:03:46 -0400 Subject: [PATCH] Add test to prompt use of TESTOPTS --- test/support/rakefile_definitions.rb | 10 ++++++++++ test/test_rake_functional.rb | 14 ++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/test/support/rakefile_definitions.rb b/test/support/rakefile_definitions.rb index d276b2fd5..b4eddb20b 100644 --- a/test/support/rakefile_definitions.rb +++ b/test/support/rakefile_definitions.rb @@ -49,6 +49,16 @@ def rakefile_test_task RAKEFILE end + def rakefile_test_task_verbose + rakefile <<-RAKEFILE + require "rake/testtask" + + Rake::TestTask.new(:unit) do |t| + t.verbose = true + end + RAKEFILE + end + def rakefile_chains rakefile <<-DEFAULT task :default => "play.app" diff --git a/test/test_rake_functional.rb b/test/test_rake_functional.rb index 9113d8616..0d3e1d0c0 100644 --- a/test/test_rake_functional.rb +++ b/test/test_rake_functional.rb @@ -384,6 +384,20 @@ def test_test_task_descriptions assert_match(/custom test task description/, @out) end + def test_test_task_when_verbose_unless_verbose_passed_not_prompt_testopts + rakefile_test_task_verbose + rake 'unit' + exp = /TESTOPTS="--verbose" to pass --verbose/ + refute_match exp, @out + end + + def test_test_task_when_verbose_passed_prompts_testopts + rakefile_test_task + rake '--verbose', 'unit' + exp = /TESTOPTS="--verbose" to pass --verbose/ + assert_match exp, @out + end + def test_comment_before_task_acts_like_desc rakefile_comments