From 5e4bb16a7f911b4399d1c52287ff5a9358116e04 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 6 Apr 2012 16:55:53 +0000 Subject: [PATCH] Additional tests for WatchersController. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9365 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/functional/watchers_controller_test.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/functional/watchers_controller_test.rb b/test/functional/watchers_controller_test.rb index 8781db797..9247b6631 100644 --- a/test/functional/watchers_controller_test.rb +++ b/test/functional/watchers_controller_test.rb @@ -51,6 +51,22 @@ class WatchersControllerTest < ActionController::TestCase end end + def test_watch_invalid_class_should_respond_with_404 + @request.session[:user_id] = 3 + assert_no_difference('Watcher.count') do + xhr :post, :watch, :object_type => 'foo', :object_id => '1' + assert_response 404 + end + end + + def test_watch_invalid_object_should_respond_with_404 + @request.session[:user_id] = 3 + assert_no_difference('Watcher.count') do + xhr :post, :watch, :object_type => 'issue', :object_id => '999' + assert_response 404 + end + end + def test_unwatch @request.session[:user_id] = 3 assert_difference('Watcher.count', -1) do