Sha256: 9d8a1e19eb3fe87b00cf64a17cf85d171ca94f16f1be346ca6b4c024ac466900

Contents?: true

Size: 984 Bytes

Versions: 5

Compression:

Stored size: 984 Bytes

Contents

require 'spec_helper'

RSpec.describe Counter::Cache do
  describe ".configure" do
    let(:clazz) { Class.new }

    it "sets counter class" do
      Counter::Cache.configure do |config|
        config.default_worker_adapter = clazz
      end
      expect(Counter::Cache.configuration.default_worker_adapter).to eq(clazz)
    end

    it "sets the redis connection" do
      Counter::Cache.configure do |config|
        config.redis_pool = clazz
      end
      expect(Counter::Cache.configuration.redis_pool).to eq(clazz)
    end

    describe "counting_data_store" do
      it "sets counting_data_store" do
        Counter::Cache.configure do |config|
          config.counting_data_store = clazz
        end
        expect(Counter::Cache.configuration.counting_data_store).to eq(clazz)
      end

      it "defaults to redis with no option" do
        expect(Counter::Cache.configuration.counting_data_store).to be_instance_of(Counter::Cache::Redis)
      end
    end


  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
counter-cache-0.3.0 spec/lib/counter/cache/config_spec.rb
counter-cache-0.2.0 spec/lib/counter/cache/config_spec.rb
counter-cache-0.1.0 spec/lib/counter/cache/config_spec.rb
counter-cache-0.0.2 spec/lib/counter/cache/config_spec.rb
counter-cache-0.0.1 spec/lib/counter/cache/config_spec.rb