Sha256: 7ced1b5e26720174a6942f952009b43fdc0f72baf3fc13660c9b59921ab6ef49
Contents?: true
Size: 921 Bytes
Versions: 7
Compression:
Stored size: 921 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) HaveReadonlyAttributesMatcher.new(*attributes).spec(self) end alias :have_readonly_attribute :have_readonly_attributes end end end
Version data entries
7 entries across 7 versions & 1 rubygems