Class: Remarkable::ActiveRecord::Matchers::AllowMassAssignmentOfMatcher

Inherits:
Matcher::Base
  • Object
show all
Defined in:
lib/remarkable/active_record/macros/validations/allow_mass_assignment_of_matcher.rb

Instance Method Summary collapse

Methods inherited from Matcher::Base

#failure_message, #negative, #negative_failure_message, #spec

Methods included from Matcher::DSL

included

Constructor Details

#initialize(*attributes) ⇒ AllowMassAssignmentOfMatcher

Returns a new instance of AllowMassAssignmentOfMatcher.



5
6
7
8
# File 'lib/remarkable/active_record/macros/validations/allow_mass_assignment_of_matcher.rb', line 5

def initialize(*attributes)
  attributes.extract_options!
  @attributes = attributes
end

Instance Method Details

#descriptionObject



19
20
21
# File 'lib/remarkable/active_record/macros/validations/allow_mass_assignment_of_matcher.rb', line 19

def description
  "allow mass assignment of #{@attributes.to_sentence}"
end

#matches?(subject) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
15
16
17
# File 'lib/remarkable/active_record/macros/validations/allow_mass_assignment_of_matcher.rb', line 10

def matches?(subject)
  @subject = subject

  assert_matcher_for(@attributes) do |attribute|
    @attribute = attribute
    allowed_to_mass_update?
  end
end