Class: Sinclair::Matchers::AddClassMethodTo Private
- Inherits:
-
AddMethodTo
- Object
- RSpec::Matchers::BuiltIn::BaseMatcher
- AddMethodTo
- Sinclair::Matchers::AddClassMethodTo
- Defined in:
- lib/sinclair/matchers/add_class_method_to.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.
AddClassMethodTo checks whether a method was or not added to a class by the call of a block
This is used with a RSpec DSL method add_class_method(method_name).to(class_object)
Instance Method Summary collapse
-
#description ⇒ String
private
Return expectaton description.
-
#failure_message_for_should ⇒ String
(also: #failure_message)
private
Returns message on expectation failure.
-
#failure_message_for_should_not ⇒ String
(also: #failure_message_when_negated)
private
Returns message on expectation failure for negative expectation.
-
#initialize(klass, method) ⇒ AddClassMethodTo
constructor
private
A new instance of AddClassMethodTo.
Methods inherited from AddMethodTo
#equal?, #matches?, #supports_block_expectations?
Constructor Details
#initialize(klass, method) ⇒ AddClassMethodTo
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 AddClassMethodTo.
40 41 42 43 |
# File 'lib/sinclair/matchers/add_class_method_to.rb', line 40 def initialize(klass, method) @klass = klass super(method) 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.
Return expectaton description
48 49 50 |
# File 'lib/sinclair/matchers/add_class_method_to.rb', line 48 def description "add method class_method '#{method}' to #{klass}" end |
#failure_message_for_should ⇒ String Also known as: failure_message
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
55 56 57 58 |
# File 'lib/sinclair/matchers/add_class_method_to.rb', line 55 def "expected class_method '#{method}' to be added to #{klass} but " \ "#{@initial_state ? 'it already existed' : "it didn't"}" end |
#failure_message_for_should_not ⇒ String Also known as: failure_message_when_negated
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
63 64 65 |
# File 'lib/sinclair/matchers/add_class_method_to.rb', line 63 def "expected class_method '#{method}' not to be added to #{klass} but it was" end |