Permalink
Browse files

even better refactoring of cover matcher

  • Loading branch information...
1 parent a87a276 commit 0f6cf3d93311d6362fe1349f6b591868f313b7fd @dchelimsky dchelimsky committed May 9, 2011
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/rspec/matchers/cover.rb
@@ -19,15 +19,15 @@ module Matchers
def cover(*expected_values)
Matcher.new :cover, *expected_values do |*_expected_values|
match_for_should do |actual|
- _expected_values.all? &cover_value
+ _expected_values.all? &covered_by(actual)
end
match_for_should_not do |actual|
- _expected_values.none? &cover_value
+ _expected_values.none? &covered_by(actual)
end
- def cover_value
- lambda {|value| actual.cover?(value)}
+ def covered_by(range)
+ lambda {|value| range.cover?(value)}
end
end
end

1 comment on commit 0f6cf3d

Contributor

justinko commented on 0f6cf3d May 9, 2011

Oh yeah much more intuitive.

Please sign in to comment.