Sha256: 5d3e4f7e6067ee8ede66fe9ca4f0b77e2d2a0d3c996694505f08d4446309e291
Contents?: true
Size: 1.14 KB
Versions: 7
Compression:
Stored size: 1.14 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 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
7 entries across 7 versions & 1 rubygems