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
This commit is contained in:
@@ -67,16 +67,36 @@ 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
|
||||
@request.session[:user_id] = 2
|
||||
assert_difference('Watcher.count', -1) do
|
||||
|
||||
Reference in New Issue
Block a user