Sha256: 5b6156f032bdf6619816701ee5e1fa74808c08f98cd67e81d5ef12748ab6f9d3
Contents?: true
Size: 907 Bytes
Versions: 13
Compression:
Stored size: 907 Bytes
Contents
module Remarkable module ActiveRecord module Matchers class HaveReadonlyAttributesMatcher < Remarkable::ActiveRecord::Base #:nodoc: arguments :collection => :attributes, :as => :attribute collection_assertions :is_readonly? private def is_readonly? readonly = subject_class.readonly_attributes || [] return readonly.include?(@attribute.to_s), :actual => readonly.to_a.inspect end end # Ensures that the attribute cannot be changed once the record has been # created. # # == Examples # # it { should have_readonly_attributes(:password, :admin_flag) } # def have_readonly_attributes(*attributes, &block) HaveReadonlyAttributesMatcher.new(*attributes, &block).spec(self) end alias :have_readonly_attribute :have_readonly_attributes end end end
Version data entries
13 entries across 13 versions & 5 rubygems