Class: Surrogate::RSpec::TimesPredicate
- Inherits:
-
Object
- Object
- Surrogate::RSpec::TimesPredicate
- Defined in:
- lib/surrogate/rspec/times_predicate.rb
Instance Attribute Summary collapse
-
#comparer ⇒ Object
Returns the value of attribute comparer.
-
#expected_times_invoked ⇒ Object
Returns the value of attribute expected_times_invoked.
Instance Method Summary collapse
- #default? ⇒ Boolean
-
#initialize(expected_times_invoked = 0, comparer = :<) ⇒ TimesPredicate
constructor
A new instance of TimesPredicate.
- #matches?(invocations) ⇒ Boolean
Constructor Details
#initialize(expected_times_invoked = 0, comparer = :<) ⇒ TimesPredicate
Returns a new instance of TimesPredicate.
5 6 7 8 |
# File 'lib/surrogate/rspec/times_predicate.rb', line 5 def initialize(expected_times_invoked=0, comparer=:<) self.expected_times_invoked = expected_times_invoked self.comparer = comparer end |
Instance Attribute Details
#comparer ⇒ Object
Returns the value of attribute comparer.
4 5 6 |
# File 'lib/surrogate/rspec/times_predicate.rb', line 4 def comparer @comparer end |
#expected_times_invoked ⇒ Object
Returns the value of attribute expected_times_invoked.
4 5 6 |
# File 'lib/surrogate/rspec/times_predicate.rb', line 4 def expected_times_invoked @expected_times_invoked end |
Instance Method Details
#default? ⇒ Boolean
14 15 16 |
# File 'lib/surrogate/rspec/times_predicate.rb', line 14 def default? expected_times_invoked == 0 && comparer == :< end |
#matches?(invocations) ⇒ Boolean
10 11 12 |
# File 'lib/surrogate/rspec/times_predicate.rb', line 10 def matches?(invocations) expected_times_invoked.send comparer, invocations.size end |