Sha256: 7aa64ca3c9267f533eb902df1940eba5e20e47d7defc3fbeb8fdac3dd99ae645
Contents?: true
Size: 1.03 KB
Versions: 7
Compression:
Stored size: 1.03 KB
Contents
module Remarkable module ActiveRecord module Matchers class AllowMassAssignmentOfMatcher < Remarkable::ActiveRecord::Base #:nodoc: arguments :collection => :attributes, :as => :attribute collection_assertions :is_protected?, :is_accessible? protected def is_protected? protected = subject_class.protected_attributes || [] protected.empty? || !protected.include?(@attribute.to_s) end def is_accessible? accessible = subject_class.accessible_attributes || [] accessible.empty? || accessible.include?(@attribute.to_s) end end # Ensures that the attribute can be set on mass update. # # == Examples # # should_allow_mass_assignment_of :email, :name # it { should allow_mass_assignment_of(:email, :name) } # def allow_mass_assignment_of(*attributes) AllowMassAssignmentOfMatcher.new(*attributes).spec(self) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems