Class: Remarkable::ActiveRecord::Matchers::HaveReadonlyAttributes
- Inherits:
-
Matcher::Base
- Object
- Matcher::Base
- Remarkable::ActiveRecord::Matchers::HaveReadonlyAttributes
- Defined in:
- lib/remarkable/active_record/macros/validations/have_readonly_attributes_matcher.rb
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(*attributes) ⇒ HaveReadonlyAttributes
constructor
A new instance of HaveReadonlyAttributes.
- #matches?(subject) ⇒ Boolean
Methods inherited from Matcher::Base
#failure_message, #negative, #negative_failure_message, #spec
Methods included from Matcher::DSL
Constructor Details
#initialize(*attributes) ⇒ HaveReadonlyAttributes
Returns a new instance of HaveReadonlyAttributes.
5 6 7 8 |
# File 'lib/remarkable/active_record/macros/validations/have_readonly_attributes_matcher.rb', line 5 def initialize(*attributes) attributes. @attributes = attributes end |
Instance Method Details
#description ⇒ Object
18 19 20 |
# File 'lib/remarkable/active_record/macros/validations/have_readonly_attributes_matcher.rb', line 18 def description "make #{@attributes.to_sentence} read-only" end |
#matches?(subject) ⇒ Boolean
10 11 12 13 14 15 16 |
# File 'lib/remarkable/active_record/macros/validations/have_readonly_attributes_matcher.rb', line 10 def matches?(subject) @subject = subject assert_matcher_for(@attributes) do |attribute| @attribute = attribute attribute_readonly? end end |