From 8fcaf4c4409d4a2ce21042b63f85566a6417ae0c Mon Sep 17 00:00:00 2001 From: cowboycoded Date: Fri, 4 Feb 2011 11:11:04 -0500 Subject: [PATCH] tests for bypassing wildcard or bot list user-agents --- test_app/Gemfile.lock | 2 +- test_app/spec/controllers/controller_spec.rb | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/test_app/Gemfile.lock b/test_app/Gemfile.lock index cb26e56..cdad697 100644 --- a/test_app/Gemfile.lock +++ b/test_app/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: /rails_plugins/mine/impressionist specs: - impressionist (0.1.0) + impressionist (0.1.1) GEM remote: http://rubygems.org/ diff --git a/test_app/spec/controllers/controller_spec.rb b/test_app/spec/controllers/controller_spec.rb index 869b7cb..cf411c3 100644 --- a/test_app/spec/controllers/controller_spec.rb +++ b/test_app/spec/controllers/controller_spec.rb @@ -41,5 +41,17 @@ describe WidgetsController do get "new" Impression.all.size.should eq 12 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 10 + 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 10 + end end \ No newline at end of file