Class: RSpec::Matchers::BuiltIn::Cover

Inherits:
BaseMatcher show all
Defined in:
lib/rspec/matchers/built_in/cover.rb

Constant Summary

Constant Summary

Constants inherited from BaseMatcher

BaseMatcher::UNDEFINED

Instance Attribute Summary

Attributes inherited from BaseMatcher

#actual, #expected, #rescued_exception

Instance Method Summary (collapse)

Methods inherited from BaseMatcher

#description, #diffable?, #failure_message_for_should, #failure_message_for_should_not, #match_unless_raises, #supports_block_expectations?

Methods included from MatchAliases

#==, #===

Methods included from Pretty

#_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

Constructor Details

- (Cover) initialize(*expected)

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

- (Boolean) does_not_match?(range)

Returns:

  • (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

- (Boolean) matches?(range)

Returns:

  • (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