244 |
244 |
assert_select 'input[name=?][value="9"]', 'watcher[user_ids][]'
|
245 |
245 |
end
|
246 |
246 |
|
|
247 |
def test_autocomplete_for_user_without_keyword_with_multiple_watchables
|
|
248 |
@request.session[:user_id] = 2
|
|
249 |
User.find(2).roles.each { |role| role.add_permission! :add_issue_watchers }
|
|
250 |
|
|
251 |
get :autocomplete_for_user, :params => {:object_type => 'issue', :object_id => [1, 4]}, :xhr => true
|
|
252 |
|
|
253 |
# Return the users of the project to which object_id belongs.
|
|
254 |
# issue 1: eCookbook, issue 4: OnlineStore
|
|
255 |
assert_response :success
|
|
256 |
assert_select 'input', :count => 3
|
|
257 |
assert_select 'input[name=?][value="2"]', 'watcher[user_ids][]'
|
|
258 |
assert_select 'input[name=?][value="3"]', 'watcher[user_ids][]'
|
|
259 |
assert_select 'input[name=?][value="8"]', 'watcher[user_ids][]'
|
|
260 |
end
|
|
261 |
|
|
262 |
def test_autocomplete_for_user_with_keyword_and_multiple_watchables
|
|
263 |
@request.session[:user_id] = 2
|
|
264 |
User.find(2).roles.each { |role| role.add_permission! :add_issue_watchers }
|
|
265 |
|
|
266 |
get :autocomplete_for_user, :params => {:object_type => 'issue', :object_id => [1, 4], :q => 'mi'}, :xhr => true
|
|
267 |
|
|
268 |
# Ignore the project and return users matching "mi".
|
|
269 |
assert_response :success
|
|
270 |
assert_select 'input', :count => 4
|
|
271 |
assert_select 'input[name=?][value="1"]', 'watcher[user_ids][]'
|
|
272 |
assert_select 'input[name=?][value="2"]', 'watcher[user_ids][]'
|
|
273 |
assert_select 'input[name=?][value="8"]', 'watcher[user_ids][]'
|
|
274 |
assert_select 'input[name=?][value="9"]', 'watcher[user_ids][]'
|
|
275 |
end
|
|
276 |
|
247 |
277 |
def test_search_non_member_on_create
|
248 |
278 |
@request.session[:user_id] = 2
|
249 |
279 |
project = Project.find_by_name("ecookbook")
|