Sha256: 95a05a01c728069aaf6542961b11244dc7cb8b8c511ed3104ef091db52c06e73

Contents?: true

Size: 1.25 KB

Versions: 3

Compression:

Stored size: 1.25 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/../../../../lib/sniffles/sniffers/analytics/google_analytics')

describe Sniffles::Sniffers::GoogleAnalytics do
  describe "#output" do
    context "inline js", :vcr => { :cassette_name => "pearsonified_com" } do
      let(:ga) { described_class.new(page_body("http://www.pearsonified.com/")) }
      
      it { ga.output[:found].should eq true }
      it { ga.output[:ua].should eq "UA-2916092-1" }
    end
    
    context "inline w/ urchin", :vcr => { :cassette_name => "humemes_com" } do
      let(:ga) { described_class.new(page_body("http://humemes.com/")) }
      
      it { ga.output[:found].should eq true }
      it { ga.output[:ua].should eq "UA-386965-7" }
    end
    
    context "inline w/ gaJsHost syntax", :vcr => { :cassette_name => "blackhatworld_com" } do
      let(:ga) { described_class.new(page_body("http://www.blackhatworld.com/index.php")) }
      
      it { ga.output[:found].should eq true }
      it { ga.output[:ua].should eq "UA-24324223-1" }
    end

    context "no google analytics" do
      let(:blank) { described_class.new(empty_html_doc) }
      it { blank.output[:found].should eq false }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sniffles-0.1.5 spec/sniffles/sniffers/analytics/google_analytics_spec.rb
sniffles-0.1.4 spec/sniffles/sniffers/analytics/google_analytics_spec.rb
sniffles-0.1.3 spec/sniffles/sniffers/analytics/google_analytics_spec.rb