Sha256: ec954d92bb6ef2c1d07f2afc22cb0a5fa7365f78023bca4e1dcd5d8a76c7582f

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 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=>@parent, :key=>123
      a.tracking_command_location.should == :head_append
    end
    it 'should set the options' do
      a = Analytical::Comscore::Api.new :parent=>@parent, :key=>1234
      a.options.should == {:key=>1234, :parent=>@parent}
    end
  end
  describe '#track' do
    it 'should return the tracking javascript' do
      @api = Analytical::Comscore::Api.new :parent=>@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=>@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=>@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

1 entries across 1 versions & 1 rubygems

Version Path
analytical-1.6.0 spec/analytical/comscore_spec.rb