Sha256: ad31e5ba70bf265615a3ee9b809b10c3dc420d6ca6f7e6c6f739fa68d5155871

Contents?: true

Size: 1021 Bytes

Versions: 2

Compression:

Stored size: 1021 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe "Analytical::Optimizely::Api" do
  before(:each) do
    @parent = mock('api', :options=>{:optimizely=>{:key=>'abc'}})
  end
  describe 'on initialize' do
    it 'should set the command_location' do
      a = Analytical::Optimizely::Api.new :parent=>@parent, :key=>'abc'
      a.tracking_command_location.should == :head_prepend
    end
    it 'should set the options' do
      a = Analytical::Optimizely::Api.new :parent=>@parent, :key=>'abc'
      a.options.should == {:key=>'abc', :parent=>@parent}
    end
  end
  describe '#init_javascript' do
    it 'should return the init javascript' do
      @api = Analytical::Optimizely::Api.new :parent=>@parent, :key=>'abcdef'
      @api.init_javascript(:head_prepend).should =~ /cdn\.optimizely.com\/js\/abcdef\.js/
      @api.init_javascript(:head_append).should == ''
      @api.init_javascript(:body_prepend).should == ''
      @api.init_javascript(:body_append).should == ''
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
analytical-1.8.0 spec/analytical/optimizely_spec.rb
analytical-1.7.0 spec/analytical/optimizely_spec.rb