Sha256: d1a59dfbb846cc1d2c90c65172f7042d37217f3434959a22062fa36a3188e844

Contents?: true

Size: 921 Bytes

Versions: 3

Compression:

Stored size: 921 Bytes

Contents

require 'spec_helper'

RSpec.describe Alephant::Broker::Cache::Client do
  before do
    allow(Alephant::Broker).to receive(:config).and_return(config)
  end

  context 'when creating a new cache client with no cache endpoint' do
    let(:config) { {} }

    it 'creates a cache client with a null client backend' do
      expect(Alephant::Broker::Cache::NullClient).to receive(:new)
      expect(Dalli::Client).not_to receive(:new)

      expect(described_class.new).to be_a described_class
    end
  end

  context 'when creating a new cache client with a cache endpoint' do
    let(:config) { { elasticache_config_endpoint: 'abc123.elasticache.aws.com:11211' } }

    it 'creates a cache client with a null client backend' do
      expect(Alephant::Broker::Cache::NullClient).not_to receive(:new)
      expect(Dalli::Client).to receive(:new)

      expect(described_class.new).to be_a described_class
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
alephant-broker-3.19.1 spec/alephant/broker/cache/client_spec.rb
alephant-broker-3.19.0 spec/alephant/broker/cache/client_spec.rb
alephant-broker-3.18.0 spec/alephant/broker/cache/client_spec.rb