Class: Remarkable::ActiveRecord::Matchers::ProtectAttributes
- Inherits:
-
Matcher::Base
- Object
- Matcher::Base
- Remarkable::ActiveRecord::Matchers::ProtectAttributes
show all
- Defined in:
- lib/remarkable/active_record/macros/validations/protect_attributes_matcher.rb
Instance Method Summary
collapse
#failure_message, #negative, #negative_failure_message, #spec
included
Constructor Details
5
6
7
8
|
# File 'lib/remarkable/active_record/macros/validations/protect_attributes_matcher.rb', line 5
def initialize(*attributes)
attributes.
@attributes = attributes
end
|
Instance Method Details
#description ⇒ Object
19
20
21
|
# File 'lib/remarkable/active_record/macros/validations/protect_attributes_matcher.rb', line 19
def description
"protect #{@attributes.to_sentence} from mass updates"
end
|
#matches?(subject) ⇒ Boolean
10
11
12
13
14
15
16
17
|
# File 'lib/remarkable/active_record/macros/validations/protect_attributes_matcher.rb', line 10
def matches?(subject)
@subject = subject
assert_matcher_for(@attributes) do |attribute|
@attribute = attribute
protect_from_mass_updates?
end
end
|