Class: MotionSpec::Matcher::HaveItems
- Defined in:
- lib/motion-spec/matcher/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.
5 6 7 |
# File 'lib/motion-spec/matcher/have_items.rb', line 5 def initialize(number_of_items) @number_of_items = number_of_items end |
Instance Method Details
#fail!(subject, negated) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/motion-spec/matcher/have_items.rb', line 20 def fail!(subject, negated) raise FailedExpectation.new( FailMessageRenderer.( negated, subject, @number_of_items, subject.size, @key_type_name ) ) end |
#matches?(value) ⇒ Boolean
9 10 11 |
# File 'lib/motion-spec/matcher/have_items.rb', line 9 def matches?(value) value.size == @number_of_items end |