diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-01-09 18:37:16 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-01-09 18:37:16 +0000 |
commit | 1b1c510ff99cfca216082926e5ce9e2e981b2506 (patch) | |
tree | ae25be505ae388435276a44a7755186c70ebe5e7 /test/functional/watchers_controller_test.rb | |
parent | c22f60271f7c6726a28b2a319041c11b2a782b5e (diff) | |
download | redmine-1b1c510ff99cfca216082926e5ce9e2e981b2506.tar.gz redmine-1b1c510ff99cfca216082926e5ce9e2e981b2506.zip |
Ability to add non-member users as watchers (#5159).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8592 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/watchers_controller_test.rb')
-rw-r--r-- | test/functional/watchers_controller_test.rb | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/test/functional/watchers_controller_test.rb b/test/functional/watchers_controller_test.rb index dc9169892..c8345a833 100644 --- a/test/functional/watchers_controller_test.rb +++ b/test/functional/watchers_controller_test.rb @@ -67,14 +67,34 @@ class WatchersControllerTest < ActionController::TestCase assert !Issue.find(1).watched_by?(User.find(3)) end - def test_new_watcher + def test_new + @request.session[:user_id] = 2 + xhr :get, :new, :object_type => 'issue', :object_id => '2' + assert_response :success + assert_select_rjs :replace_html, 'ajax-modal' + end + + def test_create @request.session[:user_id] = 2 assert_difference('Watcher.count') do - xhr :post, :new, :object_type => 'issue', :object_id => '2', :watcher => {:user_id => '4'} + xhr :post, :create, :object_type => 'issue', :object_id => '2', :watcher => {:user_id => '4'} + assert_response :success + assert_select_rjs :replace_html, 'watchers' + assert_select_rjs :replace_html, 'ajax-modal' + end + assert Issue.find(2).watched_by?(User.find(4)) + end + + def test_create_multiple + @request.session[:user_id] = 2 + assert_difference('Watcher.count', 2) do + xhr :post, :create, :object_type => 'issue', :object_id => '2', :watcher => {:user_ids => ['4', '7']} assert_response :success assert_select_rjs :replace_html, 'watchers' + assert_select_rjs :replace_html, 'ajax-modal' end assert Issue.find(2).watched_by?(User.find(4)) + assert Issue.find(2).watched_by?(User.find(7)) end def test_remove_watcher |