Class: Ramcrest::HasSize::Matcher

Inherits:
Object
  • Object
show all
Includes:
Matcher
Defined in:
lib/ramcrest/has_size.rb

Instance Method Summary collapse

Methods included from Matcher

#matches?, #mismatch, #success

Constructor Details

#initialize(expected) ⇒ Matcher

Returns a new instance of Matcher.



14
15
16
# File 'lib/ramcrest/has_size.rb', line 14

def initialize(expected)
  @expected = expected
end

Instance Method Details

#descriptionObject



26
27
28
# File 'lib/ramcrest/has_size.rb', line 26

def description
  "an enumerable of size #{@expected.description}"
end

#do_match(expected, actual) ⇒ Object



18
19
20
# File 'lib/ramcrest/has_size.rb', line 18

def do_match(expected, actual)
  super expected, actual.size
end

#mismatch_message(actual, match) ⇒ Object



22
23
24
# File 'lib/ramcrest/has_size.rb', line 22

def mismatch_message(actual, match)
  "size #{match.description}"
end