add tests for non member watchers (#15622)
git-svn-id: http://svn.redmine.org/redmine/trunk@12396 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
4823d03423
commit
c74f6d9f9b
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue