Sha256: 370faedc7386dc25db41bb107d4b3d6df2f2f282e9bd0017bc950011573192ac

Contents?: true

Size: 712 Bytes

Versions: 12

Compression:

Stored size: 712 Bytes

Contents

require 'spec_helper'

describe ArAsyncCounterCache::ActiveRecord do

  context "callbacks" do

    subject { User.create(:name => "Susan") }

    it "should increment" do
      ArAsyncCounterCache::IncrementCountersWorker.should_receive(:cache_and_enqueue).with("User", subject.id, "posts_count", :increment)
      subject.posts.create(:body => "I have a cat!")
    end

    it "should increment" do
      ArAsyncCounterCache::IncrementCountersWorker.stub(:cache_and_enqueue)
      post = subject.posts.create(:body => "I have a cat!")
      ArAsyncCounterCache::IncrementCountersWorker.should_receive(:cache_and_enqueue).with("User", subject.id, "posts_count", :decrement)
      post.destroy
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
ar-resque-counter-cache-2.1.0 spec/ar_resque_counter_cache/active_record_spec.rb
ar-resque-counter-cache-2.0.3 spec/ar_resque_counter_cache/active_record_spec.rb
ar-resque-counter-cache-2.0.2 spec/ar_resque_counter_cache/active_record_spec.rb
ar-resque-counter-cache-1.0.2 spec/ar_resque_counter_cache/active_record_spec.rb
ar-resque-counter-cache-2.0.1 spec/ar_resque_counter_cache/active_record_spec.rb
ar-resque-counter-cache-1.0.1 spec/ar_resque_counter_cache/active_record_spec.rb
ar-resque-counter-cache-2.0.0 spec/ar_resque_counter_cache/active_record_spec.rb
ar-resque-counter-cache-1.0.0 spec/ar_resque_counter_cache/active_record_spec.rb
ar-resque-counter-cache-0.0.2 spec/ar_resque_counter_cache/active_record_spec.rb
ar-resque-counter-cache-0.0.1 spec/ar_resque_counter_cache/active_record_spec.rb
ar-async-counter-cache-0.1.2 spec/ar_async_counter_cache/active_record_spec.rb
ar-async-counter-cache-0.1.1 spec/ar_async_counter_cache/active_record_spec.rb