Sha256: fc4c85cdbbae1d141bda25a0ec80eb9772adb46aba818d021a7061c653421b36

Contents?: true

Size: 1.45 KB

Versions: 13

Compression:

Stored size: 1.45 KB

Contents

require 'spec_helper'

describe WidgetsController do

  before(:each) do
    @widget = Widget.find(1)
    Widget.stub(:find).and_return(@widget)
  end

  it "should log impression at the per action level" do
    get "show", :id=> 1
    Impression.all.size.should eq 12
    get "index"
    Impression.all.size.should eq 13
    get "new"
    Impression.all.size.should eq 13
  end

  it "should not log impression when user-agent is in wildcard list" do
    request.stub(:user_agent).and_return('somebot')
    get "show", :id=> 1
    Impression.all.size.should eq 11
  end

  it "should not log impression when user-agent is in the bot list" do
    request.stub(:user_agent).and_return('Acoon Robot v1.50.001')
    get "show", :id=> 1
    Impression.all.size.should eq 11
  end

  context "impressionist unique options" do

    it "should log unique impressions at the per action level" do
      get "show", :id=> 1
      Impression.all.size.should eq 12
      get "show", :id=> 2
      Impression.all.size.should eq 13
      get "show", :id => 2
      Impression.all.size.should eq 13
      get "index"
      Impression.all.size.should eq 14
    end

    it "should log unique impressions only once per id" do
      get "show", :id=> 1
      Impression.all.size.should eq 12

      get "show", :id=> 2
      Impression.all.size.should eq 13

      get "show", :id => 2
      Impression.all.size.should eq 13

      get "index"
      Impression.all.size.should eq 14
    end

  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
impressionist-1.5.1 tests/test_app/spec/controllers/widgets_controller_spec.rb
impressionist-1.4.13 tests/test_app/spec/controllers/widgets_controller_spec.rb
impressionist-1.4.12 tests/test_app/spec/controllers/widgets_controller_spec.rb
impressionist-1.4.11 tests/test_app/spec/controllers/widgets_controller_spec.rb
impressionist-1.4.10 tests/test_app/spec/controllers/widgets_controller_spec.rb
impressionist-1.4.9 tests/test_app/spec/controllers/widgets_controller_spec.rb
impressionist-1.4.8 tests/test_app/spec/controllers/widgets_controller_spec.rb
impressionist-1.4.7 tests/test_app/spec/controllers/widgets_controller_spec.rb
impressionist-1.4.6 tests/test_app/spec/controllers/widgets_controller_spec.rb
impressionist-1.4.5 tests/test_app/spec/controllers/widgets_controller_spec.rb
impressionist-1.4.4 tests/test_app/spec/controllers/widgets_controller_spec.rb
impressionist-1.4.3 tests/test_app/spec/controllers/widgets_controller_spec.rb
impressionist-1.4.2 tests/test_app/spec/controllers/widgets_controller_spec.rb