Class: ConvenientService::RSpec::PrimitiveMatchers::Classes::HaveAbstractMethod
- Inherits:
-
Object
- Object
- ConvenientService::RSpec::PrimitiveMatchers::Classes::HaveAbstractMethod
- Defined in:
- lib/convenient_service/rspec/primitive_matchers/classes/have_abstract_method.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(method_name) ⇒ HaveAbstractMethod
constructor
A new instance of HaveAbstractMethod.
- #matches?(object) ⇒ Boolean
Constructor Details
#initialize(method_name) ⇒ HaveAbstractMethod
Returns a new instance of HaveAbstractMethod.
8 9 10 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/have_abstract_method.rb', line 8 def initialize(method_name) @method_name = method_name end |
Instance Method Details
#description ⇒ Object
26 27 28 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/have_abstract_method.rb', line 26 def description "have abstract method `#{method_name}`" end |
#failure_message ⇒ Object
30 31 32 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/have_abstract_method.rb', line 30 def "expected `#{object.class}` to have abstract method `#{method_name}`" end |
#failure_message_when_negated ⇒ Object
34 35 36 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/have_abstract_method.rb', line 34 def "expected `#{object.class}` NOT to have abstract method `#{method_name}`" end |
#matches?(object) ⇒ Boolean
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/have_abstract_method.rb', line 12 def matches?(object) @object = object begin object.__send__(method_name) false rescue ConvenientService::Support::AbstractMethod::Exceptions::AbstractMethodNotOverridden true rescue false end end |