Class: RSpec::Matchers::BuiltIn::Cover
- Inherits:
-
BaseMatcher
- Object
- BaseMatcher
- RSpec::Matchers::BuiltIn::Cover
- Defined in:
- lib/rspec/matchers/built_in/cover.rb
Instance Attribute Summary
Attributes inherited from BaseMatcher
#actual, #expected, #rescued_exception
Instance Method Summary collapse
- #does_not_match?(range) ⇒ Boolean
-
#initialize(*expected) ⇒ Cover
constructor
A new instance of Cover.
- #matches?(range) ⇒ Boolean
Methods inherited from BaseMatcher
#==, #description, #diffable?, #failure_message_for_should, #failure_message_for_should_not, #match_unless_raises
Methods included from Pretty
#_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #underscore
Constructor Details
#initialize(*expected) ⇒ Cover
Returns a new instance of Cover.
5 6 7 |
# File 'lib/rspec/matchers/built_in/cover.rb', line 5 def initialize(*expected) @expected = expected end |
Instance Method Details
#does_not_match?(range) ⇒ Boolean
14 15 16 17 |
# File 'lib/rspec/matchers/built_in/cover.rb', line 14 def does_not_match?(range) @actual = range expected.none? { |e| range.cover?(e) } end |
#matches?(range) ⇒ Boolean
9 10 11 12 |
# File 'lib/rspec/matchers/built_in/cover.rb', line 9 def matches?(range) @actual = range @expected.all? { |e| range.cover?(e) } end |