Sha256: 2c726d0def3d78dfefa1e597ce8e6e1c0a0b7d31419033a997a314ad6c574729
Contents?: true
Size: 715 Bytes
Versions: 9
Compression:
Stored size: 715 Bytes
Contents
require 'spec_helper' class BeforeRecordUpdateCollection < RecordCollection::Base attribute :section attribute :admin before_record_update{|record| record.admin = true } end RSpec.describe BeforeRecordUpdateCollection do subject { described_class.new } it "executes on the record" do employee = Employee.create section: 'SE1', admin: false described_class.new([employee]).update({}) employee.reload employee.admin.should be true end it "will be overriden by the actual update action (hence before)" do employee = Employee.create section: 'SE1', admin: false described_class.new([employee]).update(admin: false) employee.reload employee.admin.should be false end end
Version data entries
9 entries across 9 versions & 1 rubygems