Sha256: d69aa0df3deb7c0722a73f8e51f7677f91c2e3f3c4378a6ae1354adbb082af72

Contents?: true

Size: 680 Bytes

Versions: 2

Compression:

Stored size: 680 Bytes

Contents

require 'spec_helper'

describe ArAsyncCounterCache::ActiveRecord do

  describe ArAsyncCounterCache::ActiveRecord::ClassMethods do
    it "should set async_counter_types" do
      Post.async_counter_types.should == {:user => "posts_count"}
      Comment.async_counter_types.should == {:user => "comments_count", :post => "count_of_comments"}
    end
  end
  
  context "callbacks" do

    before(:each) do
      @user = User.create(:name => "Susan")
    end
    
    it "should queue job" do
      Resque.should_receive(:enqueue).with(ArAsyncCounterCache::IncrementCountersJob, "Post", an_instance_of(Fixnum))
      @user.posts.create(:body => "I have a cat!")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ar-async-counter-cache-0.0.3 spec/ar_async_counter_cache/active_record_spec.rb
ar-async-counter-cache-0.0.2 spec/ar_async_counter_cache/active_record_spec.rb