summaryrefslogtreecommitdiffstats
path: root/test/functional/watchers_controller_test.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2013-12-09 06:16:03 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2013-12-09 06:16:03 +0000
commitc74f6d9f9bcf02ccc480a2028802b83ec5d91aca (patch)
tree6699ef2ac6ca8cf68d73ddade02b792ddd5d5df4 /test/functional/watchers_controller_test.rb
parent4823d03423e82db3ccce7d3ca9f18b921f579dcc (diff)
downloadredmine-c74f6d9f9bcf02ccc480a2028802b83ec5d91aca.tar.gz
redmine-c74f6d9f9bcf02ccc480a2028802b83ec5d91aca.zip
add tests for non member watchers (#15622)
git-svn-id: http://svn.redmine.org/redmine/trunk@12396 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/watchers_controller_test.rb')
-rw-r--r--test/functional/watchers_controller_test.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/functional/watchers_controller_test.rb b/test/functional/watchers_controller_test.rb
index 4290a4fac..03ecbfbc8 100644
--- a/test/functional/watchers_controller_test.rb
+++ b/test/functional/watchers_controller_test.rb
@@ -164,6 +164,17 @@ class WatchersControllerTest < ActionController::TestCase
assert_select 'input[name=?][value=9]', 'watcher[user_ids][]'
end
+ def test_search_non_member_on_create
+ @request.session[:user_id] = 2
+ project = Project.find_by_name("ecookbook")
+ user = User.generate!(:firstname => 'issue15622')
+ membership = user.membership(project)
+ assert_nil membership
+ xhr :get, :autocomplete_for_user, :q => 'issue15622', :project_id => 'ecookbook'
+ assert_response :success
+ assert_select 'input', :count => 1
+ end
+
def test_autocomplete_on_watchable_update
@request.session[:user_id] = 2
xhr :get, :autocomplete_for_user, :q => 'mi', :object_id => '2',
@@ -175,6 +186,26 @@ class WatchersControllerTest < ActionController::TestCase
assert_select 'input[name=?][value=9]', 'watcher[user_ids][]'
end
+ def test_search_and_add_non_member_on_update
+ @request.session[:user_id] = 2
+ project = Project.find_by_name("ecookbook")
+ user = User.generate!(:firstname => 'issue15622')
+ membership = user.membership(project)
+ assert_nil membership
+ xhr :get, :autocomplete_for_user, :q => 'issue15622', :object_id => '2',
+ :object_type => 'issue', :project_id => 'ecookbook'
+ assert_response :success
+ assert_select 'input', :count => 1
+ assert_difference('Watcher.count', 1) do
+ xhr :post, :create, :object_type => 'issue', :object_id => '2',
+ :watcher => {:user_ids => ["#{user.id}"]}
+ assert_response :success
+ assert_match /watchers/, response.body
+ assert_match /ajax-modal/, response.body
+ end
+ assert Issue.find(2).watched_by?(user)
+ end
+
def test_append
@request.session[:user_id] = 2
assert_no_difference 'Watcher.count' do