Class: Sinclair::Matchers::ChangeInstanceMethodOn Private
- Inherits:
-
ChangeMethodOn
- Object
- RSpec::Matchers::BuiltIn::BaseMatcher
- Base
- ChangeMethodOn
- Sinclair::Matchers::ChangeInstanceMethodOn
- Defined in:
- lib/sinclair/matchers/change_instance_method_on.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Checks if a method was changed by the call of a block
This is used with a RSpec DSL method
change_method(method_name).on(class_object)
Instance Method Summary collapse
-
#description ⇒ String
private
Returnst expectaton description.
-
#failure_message_for_should ⇒ String
private
Returns message on expectation failure.
-
#failure_message_for_should_not ⇒ String
private
Returns message on expectation failure for negative expectation.
-
#initialize(target, method_name) ⇒ ChangeInstanceMethodOn
constructor
private
A new instance of ChangeInstanceMethodOn.
Methods included from MethodTo
#failure_message, #failure_message_when_negated, #matches?
Methods inherited from Base
#equal?, #supports_block_expectations?
Constructor Details
#initialize(klass, method_name) ⇒ ChangeInstanceMethodOn #initialize(instance, method_name) ⇒ ChangeInstanceMethodOn
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ChangeInstanceMethodOn.
23 24 25 26 27 28 29 30 31 |
# File 'lib/sinclair/matchers/change_instance_method_on.rb', line 23 def initialize(target, method_name) if target.is_a?(Class) @klass = target else @instance = target end super(method_name) end |
Instance Method Details
#description ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returnst expectaton description
36 37 38 |
# File 'lib/sinclair/matchers/change_instance_method_on.rb', line 36 def description "change method '#{method_name}' on #{klass} instances" end |
#failure_message_for_should ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns message on expectation failure
43 44 45 46 |
# File 'lib/sinclair/matchers/change_instance_method_on.rb', line 43 def "expected '#{method_name}' to be changed on #{klass} but " \ "#{initial_state ? "it didn't" : "it didn't exist"}" end |
#failure_message_for_should_not ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns message on expectation failure for negative expectation
51 52 53 |
# File 'lib/sinclair/matchers/change_instance_method_on.rb', line 51 def "expected '#{method_name}' not to be changed on #{klass} but it was" end |