Object
@private
# File lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb, line 86 def as(role) if active_model_less_than_3_1? raise 'You can specify role only in Rails 3.1 or greater' end @options[:role] = role self end
# File lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb, line 119 def description [base_description, role_description].compact.join(' ') end
# File lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb, line 94 def matches?(subject) @subject = subject if attr_mass_assignable? if whitelisting? @failure_message_when_negated = "#{@attribute} was made accessible" else if protected_attributes.empty? @failure_message_when_negated = 'no attributes were protected' else @failure_message_when_negated = "#{class_name} is protecting " << "#{protected_attributes.to_a.to_sentence}, " << "but not #{@attribute}." end end true else if whitelisting? @failure_message = "Expected #{@attribute} to be accessible" else @failure_message = "Did not expect #{@attribute} to be protected" end false end end
Generated with the Darkfish Rdoc Generator 2.