Sha256: 8aae22908cd093db3a9c77ce5340f8d0111f29f6461b97e4b20d21646a384a8f
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
remarkable_activerecord-3.0.1 | lib/remarkable_activerecord/matchers/allow_mass_assignment_of_matcher.rb |