Skip to content

Commit

Permalink
Merge pull request #151 from MarkDBlackwell/mdb/verbose-prompt-TESTOPTS
Browse files Browse the repository at this point in the history
TestTask when --verbose prompts for TESTOPTS="--verbose"
  • Loading branch information
hsbt authored Aug 4, 2016
2 parents feffec8 + 2a9a472 commit 93e7ba2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/rake/testtask.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ def define
desc @description
task @name => Array(deps) do
FileUtilsExt.verbose(@verbose) do
puts "Use TESTOPTS=\"--verbose\" to pass --verbose" \
", etc. to runners." if ARGV.include? '--verbose'
args =
"#{ruby_opts_string} #{run_code} " +
"#{file_list_string} #{option_list}"
Expand Down
10 changes: 10 additions & 0 deletions test/support/rakefile_definitions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 14 additions & 0 deletions test/test_rake_functional.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 93e7ba2

Please sign in to comment.