Class: Surrogate::RSpec::AbstractFailureMessage
- Inherits:
-
Object
- Object
- Surrogate::RSpec::AbstractFailureMessage
- Defined in:
- lib/surrogate/rspec/abstract_failure_message.rb
Direct Known Subclasses
NounMatcher::FailureMessageShouldDefault, NounMatcher::FailureMessageShouldNotDefault, NounMatcher::FailureMessageShouldNotTimes, NounMatcher::FailureMessageShouldNotWith, NounMatcher::FailureMessageShouldNotWithTimes, NounMatcher::FailureMessageShouldTimes, NounMatcher::FailureMessageShouldWith, NounMatcher::FailureMessageWithTimes, PredicateMatcher::FailureMessageShouldDefault, PredicateMatcher::FailureMessageShouldNotDefault, PredicateMatcher::FailureMessageShouldNotTimes, PredicateMatcher::FailureMessageShouldNotWith, PredicateMatcher::FailureMessageShouldNotWithTimes, PredicateMatcher::FailureMessageShouldTimes, PredicateMatcher::FailureMessageShouldWith, PredicateMatcher::FailureMessageWithTimes, VerbMatcher::FailureMessageShouldDefault, VerbMatcher::FailureMessageShouldNotDefault, VerbMatcher::FailureMessageShouldNotTimes, VerbMatcher::FailureMessageShouldNotWith, VerbMatcher::FailureMessageShouldNotWithTimes, VerbMatcher::FailureMessageShouldTimes, VerbMatcher::FailureMessageShouldWith, VerbMatcher::FailureMessageWithTimes
Defined Under Namespace
Classes: ArgsInspector
Instance Attribute Summary collapse
-
#invocations ⇒ Object
Returns the value of attribute invocations.
-
#method_name ⇒ Object
Returns the value of attribute method_name.
-
#times_predicate ⇒ Object
Returns the value of attribute times_predicate.
-
#with_filter ⇒ Object
Returns the value of attribute with_filter.
Instance Method Summary collapse
- #expected_invocation ⇒ Object
- #expected_times_invoked ⇒ Object
- #get_message ⇒ Object
-
#initialize(method_name, invocations, with_filter, times_predicate) ⇒ AbstractFailureMessage
constructor
A new instance of AbstractFailureMessage.
- #inspect_arguments(arguments) ⇒ Object
- #times_invoked ⇒ Object
- #times_msg(n) ⇒ Object
Constructor Details
#initialize(method_name, invocations, with_filter, times_predicate) ⇒ AbstractFailureMessage
Returns a new instance of AbstractFailureMessage.
22 23 24 25 26 27 |
# File 'lib/surrogate/rspec/abstract_failure_message.rb', line 22 def initialize(method_name, invocations, with_filter, times_predicate) self.method_name = method_name self.invocations = invocations self.with_filter = with_filter self.times_predicate = times_predicate end |
Instance Attribute Details
#invocations ⇒ Object
Returns the value of attribute invocations.
20 21 22 |
# File 'lib/surrogate/rspec/abstract_failure_message.rb', line 20 def invocations @invocations end |
#method_name ⇒ Object
Returns the value of attribute method_name.
20 21 22 |
# File 'lib/surrogate/rspec/abstract_failure_message.rb', line 20 def method_name @method_name end |
#times_predicate ⇒ Object
Returns the value of attribute times_predicate.
20 21 22 |
# File 'lib/surrogate/rspec/abstract_failure_message.rb', line 20 def times_predicate @times_predicate end |
#with_filter ⇒ Object
Returns the value of attribute with_filter.
20 21 22 |
# File 'lib/surrogate/rspec/abstract_failure_message.rb', line 20 def with_filter @with_filter end |
Instance Method Details
#expected_invocation ⇒ Object
46 47 48 |
# File 'lib/surrogate/rspec/abstract_failure_message.rb', line 46 def expected_invocation with_filter.expected_invocation end |
#expected_times_invoked ⇒ Object
54 55 56 |
# File 'lib/surrogate/rspec/abstract_failure_message.rb', line 54 def expected_times_invoked times_predicate.expected_times_invoked end |
#get_message ⇒ Object
29 30 31 |
# File 'lib/surrogate/rspec/abstract_failure_message.rb', line 29 def raise "I should have been overridden" end |
#inspect_arguments(arguments) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/surrogate/rspec/abstract_failure_message.rb', line 37 def inspect_arguments(arguments) # can we fix this as soon as an array enters the system instead of catching it here? if arguments.kind_of? Invocation ArgsInspector.inspect arguments else ArgsInspector.inspect Invocation.new arguments end end |
#times_invoked ⇒ Object
33 34 35 |
# File 'lib/surrogate/rspec/abstract_failure_message.rb', line 33 def times_invoked invocations.size end |
#times_msg(n) ⇒ Object
50 51 52 |
# File 'lib/surrogate/rspec/abstract_failure_message.rb', line 50 def times_msg(n) "#{n} time#{'s' unless n == 1}" end |