From 495e0a42731beef4cdcc6c7606fc30cee677c4e5 Mon Sep 17 00:00:00 2001 From: Ty Rauber Date: Sat, 30 Mar 2013 13:30:56 -0700 Subject: [PATCH] Test coverage around impressions for non-restful controller actions. Added dummy route, index method, view and dummy controller spec. --- test_app/app/controllers/dummy_controller.rb | 2 ++ test_app/app/views/dummy/index.html.erb | 0 test_app/config/routes.rb | 2 +- test_app/spec/controllers/controller_spec.rb | 9 +++++++++ 4 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 test_app/app/views/dummy/index.html.erb diff --git a/test_app/app/controllers/dummy_controller.rb b/test_app/app/controllers/dummy_controller.rb index 86664a6..c90cd9c 100644 --- a/test_app/app/controllers/dummy_controller.rb +++ b/test_app/app/controllers/dummy_controller.rb @@ -3,4 +3,6 @@ class DummyController < ActionController::Base impressionist + def index + end end diff --git a/test_app/app/views/dummy/index.html.erb b/test_app/app/views/dummy/index.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/test_app/config/routes.rb b/test_app/config/routes.rb index 7bcb78e..76cb5b5 100644 --- a/test_app/config/routes.rb +++ b/test_app/config/routes.rb @@ -1,3 +1,3 @@ TestApp::Application.routes.draw do - resources :articles, :posts, :widgets + resources :articles, :posts, :widgets, :dummy end diff --git a/test_app/spec/controllers/controller_spec.rb b/test_app/spec/controllers/controller_spec.rb index a48b3a0..7f1307a 100644 --- a/test_app/spec/controllers/controller_spec.rb +++ b/test_app/spec/controllers/controller_spec.rb @@ -123,3 +123,12 @@ describe WidgetsController do end end +describe DummyController do + fixtures :impressions + render_views + + it "should log impression at the per action level on non-restful controller" do + get "index" + Impression.all.size.should eq 12 + end +end \ No newline at end of file