Class: Sinclair::Matchers::AddClassMethodTo Private
- Inherits:
-
AddMethodTo
- Object
- RSpec::Matchers::BuiltIn::BaseMatcher
- Base
- 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
private
Returns message on expectation failure.
-
#failure_message_for_should_not ⇒ String
private
Returns message on expectation failure for negative expectation.
-
#initialize(klass, method_name) ⇒ AddClassMethodTo
constructor
private
A new instance of AddClassMethodTo.
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) ⇒ 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_name) @klass = klass 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.
Return expectaton description
48 49 50 |
# File 'lib/sinclair/matchers/add_class_method_to.rb', line 48 def description "add class method '#{method_name}' to #{klass}" 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
55 56 57 58 |
# File 'lib/sinclair/matchers/add_class_method_to.rb', line 55 def "expected class method '#{method_name}' to be added to #{klass} but " \ "#{initial_state ? 'it already existed' : "it didn't"}" 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
63 64 65 |
# File 'lib/sinclair/matchers/add_class_method_to.rb', line 63 def "expected class method '#{method_name}' not to be added to #{klass} but it was" end |