Sha256: 6483eeca2f18ebdba01d4779e3129e5884a9706fa0841830989550b4ae16ef68
Contents?: true
Size: 937 Bytes
Versions: 11
Compression:
Stored size: 937 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
11 entries across 11 versions & 1 rubygems