Class: BaconExpect::Matcher::HaveItems
- Inherits:
-
Object
- Object
- BaconExpect::Matcher::HaveItems
- Defined in:
- lib/bacon-expect/matchers/have_items.rb
Instance Method Summary collapse
- #fail!(subject, negated) ⇒ Object
-
#initialize(number_of_items) ⇒ HaveItems
constructor
A new instance of HaveItems.
- #matches?(value) ⇒ Boolean
Constructor Details
#initialize(number_of_items) ⇒ HaveItems
Returns a new instance of HaveItems.
3 4 5 |
# File 'lib/bacon-expect/matchers/have_items.rb', line 3 def initialize(number_of_items) @number_of_items = number_of_items end |
Instance Method Details
#fail!(subject, negated) ⇒ Object
18 19 20 |
# File 'lib/bacon-expect/matchers/have_items.rb', line 18 def fail!(subject, negated) raise FailedExpectation.new(FailMessageRenderer.(negated, subject, @number_of_items, subject.size, @key_type_name)) end |
#matches?(value) ⇒ Boolean
7 8 9 |
# File 'lib/bacon-expect/matchers/have_items.rb', line 7 def matches?(value) value.size == @number_of_items end |