Sha256: 7d9e7cdb861dab3d9004133c018815733ad54a37b7402e36ab788f9a5e447fae
Contents?: true
Size: 818 Bytes
Versions: 5
Compression:
Stored size: 818 Bytes
Contents
require 'spec_helper' RSpec.describe Counter::Cache::ActiveRecordUpdater do let(:counter_class) { double } let(:counter) { double } let(:options) { { counter_class: counter_class } } subject { Counter::Cache::ActiveRecordUpdater.new(options) } let(:record) { double } describe "#after_create" do it "Calls update on counter instance" do expect(counter).to receive(:update).with(:incr) expect(counter_class).to receive(:new).with(record, options).and_return(counter) subject.after_create(record) end end describe "#after_destroy" do it "Calls update on counter instance" do expect(counter).to receive(:update).with(:decr) expect(counter_class).to receive(:new).with(record, options).and_return(counter) subject.after_destroy(record) end end end
Version data entries
5 entries across 5 versions & 1 rubygems