summaryrefslogtreecommitdiffstats
path: root/test/functional/watchers_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-06 16:55:53 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-06 16:55:53 +0000
commit5e4bb16a7f911b4399d1c52287ff5a9358116e04 (patch)
treee2e2d5108170392721a95743749d037250148d2a /test/functional/watchers_controller_test.rb
parent2e240103f381ed32cbbf296beddab9536dde050c (diff)
downloadredmine-5e4bb16a7f911b4399d1c52287ff5a9358116e04.tar.gz
redmine-5e4bb16a7f911b4399d1c52287ff5a9358116e04.zip
Additional tests for WatchersController.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9365 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/watchers_controller_test.rb')
-rw-r--r--test/functional/watchers_controller_test.rb16
1 files changed, 16 insertions, 0 deletions
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