Sha256: a099746677a3ee1c748bc7d9a9aedc8ac4d2226c4956d28881534d8266c3ab53

Contents?: true

Size: 450 Bytes

Versions: 15

Compression:

Stored size: 450 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
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
record_collection-0.8.2 spec/base/after_record_update_spec.rb
record_collection-0.8.1 spec/base/after_record_update_spec.rb
record_collection-0.7.5 spec/base/after_record_update_spec.rb
record_collection-0.7.4 spec/base/after_record_update_spec.rb
record_collection-0.7.3 spec/base/after_record_update_spec.rb
record_collection-0.7.2 spec/base/after_record_update_spec.rb
record_collection-0.7.1 spec/base/after_record_update_spec.rb
record_collection-0.7.0 spec/base/after_record_update_spec.rb
record_collection-0.6.1 spec/base/after_record_update_spec.rb
record_collection-0.6.0 spec/base/after_record_update_spec.rb
record_collection-0.5.3 spec/base/after_record_update_spec.rb
record_collection-0.5.2 spec/base/after_record_update_spec.rb
record_collection-0.5.1 spec/base/after_record_update_spec.rb
record_collection-0.5.0 spec/base/after_record_update_spec.rb
record_collection-0.4.6 spec/base/after_record_update_spec.rb