Sha256: aa25381a4174fa495825397213a402acb1eceacc48b443bef0be9040119e1255

Contents?: true

Size: 1.17 KB

Versions: 21

Compression:

Stored size: 1.17 KB

Contents

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

describe "Analytical::Modules::Chartbeat" do
  before(:each) do
    @parent = mock('api', :options=>{:chartbeat=>{:key=>1234, :domain =>'test.com'}})
  end
  describe 'on initialize' do
    it 'should set the command_location' do
      a = Analytical::Modules::Chartbeat.new :parent=>@parent, :key=>1234
      a.tracking_command_location.should == [:head_prepend, :body_append]
    end
    it 'should set the options' do
      a = Analytical::Modules::Chartbeat.new :parent=>@parent, :key=>12345, :domain =>'abcdef.com'
      a.options.should == {:key=>12345, :domain => 'abcdef.com', :parent=>@parent}
    end
  end
  describe '#init_javascript' do
    it 'should return the init javascript' do
      @api = Analytical::Modules::Chartbeat.new :parent=>@parent, :key=>12345, :domain =>'abcdef.com'
      @api.init_javascript(:head_prepend).should =~ /_sf_startpt=\(new.Date\(\)\)\.getTime\(\);/
      @api.init_javascript(:head_append).should == ''
      @api.init_javascript(:body_prepend).should == ''
      @api.init_javascript(:body_append).should =~ /_sf_async_config=\{uid:12345,.*domain:"abcdef\.com"\};/
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
analytical-3.0.8 spec/analytical/modules/chartbeat_spec.rb
analytical-3.0.7 spec/analytical/modules/chartbeat_spec.rb
analytical-3.0.6 spec/analytical/modules/chartbeat_spec.rb
gsiener-analytical-2.10.2 spec/analytical/modules/chartbeat_spec.rb
gsiener-analytical-2.10.1 spec/analytical/modules/chartbeat_spec.rb
analytical-2.11.0 spec/analytical/modules/chartbeat_spec.rb
analytical-2.10.0 spec/analytical/modules/chartbeat_spec.rb
gsiener-analytical-2.10.0 spec/analytical/modules/chartbeat_spec.rb
analytical-2.9.0 spec/analytical/modules/chartbeat_spec.rb
analytical-2.8.0 spec/analytical/modules/chartbeat_spec.rb
analytical-2.7.2 spec/analytical/modules/chartbeat_spec.rb
analytical-2.7.1 spec/analytical/modules/chartbeat_spec.rb
analytical-2.7.0 spec/analytical/modules/chartbeat_spec.rb
analytical-2.6.0 spec/analytical/modules/chartbeat_spec.rb
analytical-2.5.0 spec/analytical/modules/chartbeat_spec.rb
analytical-2.4.0 spec/analytical/modules/chartbeat_spec.rb
analytical-2.3.0 spec/analytical/modules/chartbeat_spec.rb
analytical-2.2.0 spec/analytical/modules/chartbeat_spec.rb
analytical-2.1.0 spec/analytical/modules/chartbeat_spec.rb
analytical-2.0.0 spec/analytical/modules/chartbeat_spec.rb