Sha256: ed288c3f10118f7a4501508ad26ec1051f1fba02803cb821c96c8da6cc00214c
Contents?: true
Size: 905 Bytes
Versions: 1
Compression:
Stored size: 905 Bytes
Contents
module Remarkable module ActiveRecord module Matchers class HaveReadonlyAttributesMatcher < Remarkable::ActiveRecord::Base 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
remarkable_activerecord-3.0.0 | lib/remarkable_activerecord/matchers/have_readonly_attributes_matcher.rb |