Sha256: 519c41ca61740ff9b0860703311773c853dcaa116dac7c06c977bb682b262c31

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 KB

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, {:key=>'abc'}
      a.tracking_command_location.should == :head_prepend
    end
    it 'should set the options' do
      a = Analytical::Optimizely::Api.new @parent, {:key=>'abc'}
      a.options.should == {:key=>'abc'}
    end
  end
  describe '#track' do
    it 'should return the tracking javascript' do
      @api = Analytical::Optimizely::Api.new @parent, {:key=>'abcdef'}
      @api.track('pagename', {:some=>'data'}).should == ''
    end
  end

  describe '#identify' do
    it 'should return an empty string' do
      @api = Analytical::Optimizely::Api.new @parent, {:key=>'abcdef'}
      @api.identify('nothing', {:matters=>'at all'}).should == ''
    end
  end

  describe '#init_javascript' do
    it 'should return the init javascript' do
      @api = Analytical::Optimizely::Api.new @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.5.0 spec/analytical/optimizely_spec.rb
analytical-1.4.0 spec/analytical/optimizely_spec.rb