From 5adc1ddde9b4a353b2d2a499004c2025d6e8847a Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 9 Apr 2016 07:37:49 +0000 Subject: Allow addition of watchers via bulk edit context menu (#5754). git-svn-id: http://svn.redmine.org/redmine/trunk@15311 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/functional/watchers_controller_test.rb | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'test/functional') diff --git a/test/functional/watchers_controller_test.rb b/test/functional/watchers_controller_test.rb index 3cbaf841a..d6220710b 100644 --- a/test/functional/watchers_controller_test.rb +++ b/test/functional/watchers_controller_test.rb @@ -133,6 +133,13 @@ class WatchersControllerTest < ActionController::TestCase assert_match /ajax-modal/, response.body end + def test_new_with_multiple_objects + @request.session[:user_id] = 2 + xhr :get, :new, :object_type => 'issue', :object_id => ['1', '2'] + assert_response :success + assert_match /ajax-modal/, response.body + end + def test_new_for_new_record_with_project_id @request.session[:user_id] = 2 xhr :get, :new, :project_id => 1 @@ -161,7 +168,7 @@ class WatchersControllerTest < ActionController::TestCase assert Issue.find(2).watched_by?(User.find(4)) end - def test_create_multiple + def test_create_with_mutiple_users @request.session[:user_id] = 2 assert_difference('Watcher.count', 2) do xhr :post, :create, :object_type => 'issue', :object_id => '2', @@ -174,6 +181,21 @@ class WatchersControllerTest < ActionController::TestCase assert Issue.find(2).watched_by?(User.find(7)) end + def test_create_with_mutiple_objects + @request.session[:user_id] = 2 + assert_difference('Watcher.count', 4) do + xhr :post, :create, :object_type => 'issue', :object_id => ['1', '2'], + :watcher => {:user_ids => ['4', '7']} + assert_response :success + assert_match /watchers/, response.body + assert_match /ajax-modal/, response.body + end + assert Issue.find(1).watched_by?(User.find(4)) + assert Issue.find(2).watched_by?(User.find(4)) + assert Issue.find(1).watched_by?(User.find(7)) + assert Issue.find(2).watched_by?(User.find(7)) + end + def test_autocomplete_on_watchable_creation @request.session[:user_id] = 2 xhr :get, :autocomplete_for_user, :q => 'mi', :project_id => 'ecookbook' -- cgit v1.2.3