Sha256: a1d065ea16b21d323c5bdeb885542b6b72e384485d6efeb82061f9631f6b4f18
Contents?: true
Size: 704 Bytes
Versions: 9
Compression:
Stored size: 704 Bytes
Contents
require 'spec_helper' class AfterRecordUpdateCollection < RecordCollection::Base attribute :section after_record_update{|record| record.update(admin: true) } end RSpec.describe AfterRecordUpdateCollection 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 not be overridden by the update action itself (hence after)" do employee = Employee.create section: 'SE1', admin: false described_class.new([employee]).update(admin: false) employee.reload employee.admin.should be true end end
Version data entries
9 entries across 9 versions & 1 rubygems