Sha256: b6064fb38899f7dfc9c66495091eb2182df02b03a94c9e79ff9f7ae478b2fb39
Contents?: true
Size: 1.94 KB
Versions: 16
Compression:
Stored size: 1.94 KB
Contents
require 'spec_helper' RSpec.describe OptimizelyServerSide do class Anonymous; end describe "#configure" do context 'when config is set in regular way' do before do OptimizelyServerSide.configure do |config| config.config_endpoint = 'https://cdn.optimizely.com/json/5960232316.json' config.cache_expiry = 12 end end it 'has config_endpoint' do expect(OptimizelyServerSide.configuration.config_endpoint).to eq('https://cdn.optimizely.com/json/5960232316.json') end it 'has cache_expiry' do expect(OptimizelyServerSide.configuration.cache_expiry).to eq(12) end it 'has empty user_attributes' do expect(OptimizelyServerSide.configuration.user_attributes).to eq({}) end end context 'when config is set in between' do before do OptimizelyServerSide.configure do |config| config.config_endpoint = 'https://cdn.optimizely.com/json/5960232316.json' config.cache_expiry = 12 config.event_dispatcher = Anonymous.new end end it 'has config_endpoint' do OptimizelyServerSide.configure do |config| config.user_attributes = { visitor_id: '1234abcdef' } end expect(OptimizelyServerSide.configuration.config_endpoint).to eq('https://cdn.optimizely.com/json/5960232316.json') end it 'has cache_expiry' do expect(OptimizelyServerSide.configuration.cache_expiry).to eq(12) end it 'has user_attributes' do expect(OptimizelyServerSide.configuration.user_attributes).to eq({visitor_id: '1234abcdef'}) end it 'has a visitor_id' do expect(OptimizelyServerSide.configuration.user_attributes[:visitor_id]).to eq('1234abcdef') end it 'has instance of event_dispatcher' do expect(OptimizelyServerSide.configuration.event_dispatcher).to be_kind_of(Anonymous) end end end end
Version data entries
16 entries across 16 versions & 1 rubygems