Additional tests for WatchersController.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9365 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-04-06 16:55:53 +00:00
parent 2e240103f3
commit 5e4bb16a7f
1 changed files with 16 additions and 0 deletions

View File

@ -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