diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2009-12-03 18:41:00 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2009-12-03 18:41:00 +0000 |
commit | e02da72947d21c85a86f49e2bdd98d06a2951939 (patch) | |
tree | 986995302d2d35d8f715110fdc7d9b11c12bb2aa /test | |
parent | 97c5362cfecee611e8bcae4c9ea0353da20b2cea (diff) | |
download | redmine-e02da72947d21c85a86f49e2bdd98d06a2951939.tar.gz redmine-e02da72947d21c85a86f49e2bdd98d06a2951939.zip |
Add a second action menu to IssuesController#show. (#4331)
Will have the update, log time, watch, copy, etc buttons. Had to rework
how the watchers button works since it requires a unique DOM id for the
Ajax response. Also modified the WatchersController to be able to replace
multiple sections of the page, e.g. two Watch links.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3119 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/watchers_controller_test.rb | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/test/functional/watchers_controller_test.rb b/test/functional/watchers_controller_test.rb index d36f7831c..cf977887e 100644 --- a/test/functional/watchers_controller_test.rb +++ b/test/functional/watchers_controller_test.rb @@ -47,6 +47,16 @@ class WatchersControllerTest < ActionController::TestCase end assert Issue.find(1).watched_by?(User.find(3)) end + + def test_watch_with_multiple_replacements + @request.session[:user_id] = 3 + assert_difference('Watcher.count') do + xhr :post, :watch, :object_type => 'issue', :object_id => '1', :replace => ['watch_item_1','watch_item_2'] + assert_response :success + assert_select_rjs :replace_html, 'watch_item_1' + assert_select_rjs :replace_html, 'watch_item_2' + end + end def test_unwatch @request.session[:user_id] = 3 @@ -57,7 +67,18 @@ class WatchersControllerTest < ActionController::TestCase end assert !Issue.find(1).watched_by?(User.find(3)) end - + + def test_unwatch_with_multiple_replacements + @request.session[:user_id] = 3 + assert_difference('Watcher.count', -1) do + xhr :post, :unwatch, :object_type => 'issue', :object_id => '2', :replace => ['watch_item_1', 'watch_item_2'] + assert_response :success + assert_select_rjs :replace_html, 'watch_item_1' + assert_select_rjs :replace_html, 'watch_item_2' + end + assert !Issue.find(1).watched_by?(User.find(3)) + end + def test_new_watcher @request.session[:user_id] = 2 assert_difference('Watcher.count') do |