Sha256: 02f2af868da23b8b781210a81f4a8aa417d3e644d4af8eccdec3e028009262aa

Contents?: true

Size: 1.41 KB

Versions: 2

Compression:

Stored size: 1.41 KB

Contents

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

describe "Analytical::Comscore::Api" do
  before(:each) do
    @parent = mock('api', :options=>{:comscore=>{:key=>123}})
  end
  describe 'on initialize' do
    it 'should set the command_location' do
      a = Analytical::Comscore::Api.new @parent, {:key=>123}
      a.tracking_command_location.should == :head_append
    end
    it 'should set the options' do
      a = Analytical::Comscore::Api.new @parent, {:key=>1234}
      a.options.should == {:key=>1234}
    end
  end
  describe '#track' do
    it 'should return the tracking javascript' do
      @api = Analytical::Comscore::Api.new @parent, {:key=>123}
      @api.track('pagename', {:some=>'data'}).should == ''
    end
  end

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

  describe '#init_javascript' do
    it 'should return the init javascript' do
      @api = Analytical::Comscore::Api.new @parent, {:key=>1234}
      @api.init_javascript(:head_prepend).should == ''
      @api.init_javascript(:head_append).should =~ /scorecardresearch.com\/beacon.js/
      @api.init_javascript(:head_append).should =~ /1234/
      @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/comscore_spec.rb
analytical-1.4.0 spec/analytical/comscore_spec.rb