Class: ConvenientService::RSpec::PrimitiveMatchers::Classes::HaveAttrAccessor
- Inherits:
-
Object
- Object
- ConvenientService::RSpec::PrimitiveMatchers::Classes::HaveAttrAccessor
- Defined in:
- lib/convenient_service/rspec/primitive_matchers/classes/have_attr_accessor.rb
Overview
TODO: Specs.
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(attr_name) ⇒ HaveAttrAccessor
constructor
A new instance of HaveAttrAccessor.
- #matches?(object) ⇒ Boolean
Constructor Details
#initialize(attr_name) ⇒ HaveAttrAccessor
Returns a new instance of HaveAttrAccessor.
11 12 13 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/have_attr_accessor.rb', line 11 def initialize(attr_name) @attr_name = attr_name end |
Instance Method Details
#description ⇒ Object
24 25 26 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/have_attr_accessor.rb', line 24 def description "have attr accessor `#{attr_name}`" end |
#failure_message ⇒ Object
28 29 30 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/have_attr_accessor.rb', line 28 def "expected `#{object.class}` to have attr accessor `#{attr_name}`" end |
#failure_message_when_negated ⇒ Object
32 33 34 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/have_attr_accessor.rb', line 32 def "expected `#{object.class}` NOT to have attr accessor `#{attr_name}`" end |
#matches?(object) ⇒ Boolean
15 16 17 18 19 20 21 22 |
# File 'lib/convenient_service/rspec/primitive_matchers/classes/have_attr_accessor.rb', line 15 def matches?(object) @object = object Classes::HaveAttrReader.new(attr_name).matches?(object) Classes::HaveAttrWriter.new(attr_name).matches?(object) true end |