Skip to content

Commit

Permalink
Fix rake task description based on configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
John Backus committed Oct 5, 2015
1 parent 5fcfa60 commit 64fa8b3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/yardstick/rake/verify.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ def total_coverage
#
# @api private
def define
desc "Verify that yardstick coverage is at least #{@threshold}%"
modifier = @config.require_exact_threshold? ? 'exactly' : 'at least'

desc "Verify that yardstick coverage is #{modifier} #{@threshold}%"
task(@name) { verify_measurements }
end

Expand Down
10 changes: 10 additions & 0 deletions spec/unit/yardstick/rake/verify/initialize_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@
end

it 'includes the threshold in the task name' do
task
expect(Rake.application.last_description)
.to eql('Verify that yardstick coverage is exactly 90%')
end
end

context 'when require_exact_threshold is false' do
before { config.require_exact_threshold = false }

it 'is reflected in the task description' do
task
expect(Rake.application.last_description)
.to eql('Verify that yardstick coverage is at least 90%')
Expand Down

0 comments on commit 64fa8b3

Please sign in to comment.