Sha256: ea303f41cd52caab03a05c4610a80c6ba37919412540a8a02289caeadf0ace0a
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
require "spec_helper" describe Split::Persistence do subject { Split::Persistence } describe ".adapter" do context "when the persistence config is a symbol" do it "should return the appropriate adapter for the symbol" do expect(Split.configuration).to receive(:persistence).twice.and_return(:cookie) expect(subject.adapter).to eq(Split::Persistence::CookieAdapter) end it "should return an adapter whose class is present in Split::Persistence::ADAPTERS" do expect(Split.configuration).to receive(:persistence).twice.and_return(:cookie) expect(Split::Persistence::ADAPTERS.values).to include(subject.adapter) end it "should raise if the adapter cannot be found" do expect(Split.configuration).to receive(:persistence).twice.and_return(:something_weird) expect { subject.adapter }.to raise_error(Split::InvalidPersistenceAdapterError) end end context "when the persistence config is a class" do let(:custom_adapter_class) { MyCustomAdapterClass = Class.new } it "should return that class" do expect(Split.configuration).to receive(:persistence).twice.and_return(custom_adapter_class) expect(subject.adapter).to eq(MyCustomAdapterClass) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
split-1.3.2 | spec/persistence_spec.rb |
split-1.3.1 | spec/persistence_spec.rb |