Class: AssociationAccessors::Test::Matcher
- Inherits:
-
Object
- Object
- AssociationAccessors::Test::Matcher
- Defined in:
- lib/association_accessors/test/matcher.rb
Instance Attribute Summary collapse
-
#association ⇒ Object
readonly
Returns the value of attribute association.
-
#association_name ⇒ Object
readonly
Returns the value of attribute association_name.
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#failure_message ⇒ Object
readonly
Returns the value of attribute failure_message.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(association_name) ⇒ Matcher
constructor
A new instance of Matcher.
- #matches?(subject) ⇒ Boolean
- #with_attribute(attribute) ⇒ Object
Constructor Details
#initialize(association_name) ⇒ Matcher
Returns a new instance of Matcher.
10 11 12 |
# File 'lib/association_accessors/test/matcher.rb', line 10 def initialize association_name @association_name = association_name end |
Instance Attribute Details
#association ⇒ Object (readonly)
Returns the value of attribute association.
8 9 10 |
# File 'lib/association_accessors/test/matcher.rb', line 8 def association @association end |
#association_name ⇒ Object (readonly)
Returns the value of attribute association_name.
8 9 10 |
# File 'lib/association_accessors/test/matcher.rb', line 8 def association_name @association_name end |
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
8 9 10 |
# File 'lib/association_accessors/test/matcher.rb', line 8 def attribute @attribute end |
#failure_message ⇒ Object (readonly)
Returns the value of attribute failure_message.
8 9 10 |
# File 'lib/association_accessors/test/matcher.rb', line 8 def @failure_message end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
8 9 10 |
# File 'lib/association_accessors/test/matcher.rb', line 8 def subject @subject end |
Instance Method Details
#description ⇒ Object
14 15 16 |
# File 'lib/association_accessors/test/matcher.rb', line 14 def description "have association accessor for #{association_name.inspect} with attribute #{attribute.inspect}." end |
#matches?(subject) ⇒ Boolean
18 19 20 21 22 23 24 25 |
# File 'lib/association_accessors/test/matcher.rb', line 18 def matches? subject @subject = subject @association = get_association check_attribute! has_accessors? end |
#with_attribute(attribute) ⇒ Object
27 28 29 30 |
# File 'lib/association_accessors/test/matcher.rb', line 27 def with_attribute attribute @attribute = attribute self end |