Sha256: 76172e872e19e5e9649a526f6983e49049205e4bc9b1b1ba51aeba938252a746
Contents?: true
Size: 1.17 KB
Versions: 4
Compression:
Stored size: 1.17 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 Split.configuration.stub(:persistence).and_return(:cookie) subject.adapter.should eq(Split::Persistence::CookieAdapter) end it "should return an adapter whose class is present in Split::Persistence::ADAPTERS" do Split.configuration.stub(:persistence).and_return(:cookie) Split::Persistence::ADAPTERS.values.should include(subject.adapter) end it "should raise if the adapter cannot be found" do Split.configuration.stub(:persistence).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 Split.configuration.stub(:persistence).and_return(custom_adapter_class) subject.adapter.should eq(MyCustomAdapterClass) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
split-0.6.2 | spec/persistence_spec.rb |
split-0.6.1 | spec/persistence_spec.rb |
split-0.6.0 | spec/persistence_spec.rb |
split-0.5.0 | spec/persistence_spec.rb |