Sha256: 6c189205c91c11370fc0d559f529c8368bec492f8faf37c07f139b917f7418a3

Contents?: true

Size: 978 Bytes

Versions: 8

Compression:

Stored size: 978 Bytes

Contents

# frozen_string_literal: true

# Sample class used for testing
RSpec.describe Basquiat::Adapters::Base do
  subject(:adapter) { Basquiat::Adapters::Base.new }

  %i[disconnect subscribe_to publish].each do |meth|
    it "raise a SubclassResponsibility error if #{meth} isn't implemented" do
      expect { adapter.public_send(meth) }.to raise_error Basquiat::Errors::SubclassResponsibility
    end
  end

  it 'raise error when using an unregistered strategy' do
    expect { adapter.class.strategy(:not_here) }.to raise_error Basquiat::Errors::StrategyNotRegistered
  end

  it 'register a requeue strategy' do
    class CoolStuff
    end
    adapter.class.register_strategy :cool_stuff, CoolStuff
    expect(adapter.strategies).to have_key :cool_stuff
  end

  it 'merges the options with the default ones' do
    opts = adapter.instance_variable_get(:@options)
    adapter.adapter_options(nice_option: '127.0.0.2')
    expect(opts[:nice_option]).to eq('127.0.0.2')
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
basquiat-1.6.0 spec/lib/adapters/base_adapter_spec.rb
basquiat-1.5.2 spec/lib/adapters/base_adapter_spec.rb
basquiat-1.5.1 spec/lib/adapters/base_adapter_spec.rb
basquiat-1.5.0 spec/lib/adapters/base_adapter_spec.rb
basquiat-1.4.0 spec/lib/adapters/base_adapter_spec.rb
basquiat-1.3.6 spec/lib/adapters/base_adapter_spec.rb
basquiat-1.3.5 spec/lib/adapters/base_adapter_spec.rb
basquiat-1.3.4 spec/lib/adapters/base_adapter_spec.rb