diff test/functional/watchers_controller_test.rb @ 524:1248a47e81b3 feature_36

Merge from branch "luisf"
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Mon, 25 Jul 2011 14:39:38 +0100
parents cbce1fd3b1b7
children cbb26bc654de
line wrap: on
line diff
--- a/test/functional/watchers_controller_test.rb	Fri Jul 15 17:21:05 2011 +0100
+++ b/test/functional/watchers_controller_test.rb	Mon Jul 25 14:39:38 2011 +0100
@@ -1,5 +1,5 @@
 # Redmine - project management software
-# Copyright (C) 2006-2008  Jean-Philippe Lang
+# Copyright (C) 2006-2011  Jean-Philippe Lang
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -15,7 +15,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
-require File.dirname(__FILE__) + '/../test_helper'
+require File.expand_path('../../test_helper', __FILE__)
 require 'watchers_controller'
 
 # Re-raise errors caught by the controller.
@@ -43,7 +43,7 @@
     assert_difference('Watcher.count') do
       xhr :post, :watch, :object_type => 'issue', :object_id => '1'
       assert_response :success
-      assert_select_rjs :replace_html, 'watcher'
+      assert @response.body.include?('$$(".issue-1-watcher")')
     end
     assert Issue.find(1).watched_by?(User.find(3))
   end
@@ -56,34 +56,13 @@
       assert_response 403
     end
   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
     assert_difference('Watcher.count', -1) do
       xhr :post, :unwatch, :object_type => 'issue', :object_id => '2'
       assert_response :success
-      assert_select_rjs :replace_html, 'watcher'
-    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'
+      assert @response.body.include?('$$(".issue-2-watcher")')
     end
     assert !Issue.find(1).watched_by?(User.find(3))
   end