##// END OF EJS Templates
Fixed test after r11343....
Jean-Philippe Lang -
r11116:7c22c307919d
parent child
Show More
@@ -1,69 +1,69
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2013 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.expand_path('../../../test_helper', __FILE__)
19 19
20 20 class WatchersHelperTest < ActionView::TestCase
21 21 include WatchersHelper
22 22 include Redmine::I18n
23 23
24 24 fixtures :users, :issues
25 25
26 26 def setup
27 27 super
28 28 set_language_if_valid('en')
29 29 User.current = nil
30 30 end
31 31
32 32 test '#watcher_link with a non-watched object' do
33 33 expected = link_to(
34 34 "Watch",
35 35 "/watchers/watch?object_id=1&object_type=issue",
36 36 :remote => true, :method => 'post', :class => "issue-1-watcher icon icon-fav-off"
37 37 )
38 38 assert_equal expected, watcher_link(Issue.find(1), User.find(1))
39 39 end
40 40
41 41 test '#watcher_link with a single objet array' do
42 42 expected = link_to(
43 43 "Watch",
44 44 "/watchers/watch?object_id=1&object_type=issue",
45 45 :remote => true, :method => 'post', :class => "issue-1-watcher icon icon-fav-off"
46 46 )
47 47 assert_equal expected, watcher_link([Issue.find(1)], User.find(1))
48 48 end
49 49
50 50 test '#watcher_link with a multiple objets array' do
51 51 expected = link_to(
52 52 "Watch",
53 53 "/watchers/watch?object_id%5B%5D=1&object_id%5B%5D=3&object_type=issue",
54 54 :remote => true, :method => 'post', :class => "issue-bulk-watcher icon icon-fav-off"
55 55 )
56 56 assert_equal expected, watcher_link([Issue.find(1), Issue.find(3)], User.find(1))
57 57 end
58 58
59 59 test '#watcher_link with a watched object' do
60 60 Watcher.create!(:watchable => Issue.find(1), :user => User.find(1))
61 61
62 62 expected = link_to(
63 63 "Unwatch",
64 "/watchers/unwatch?object_id=1&object_type=issue",
65 :remote => true, :method => 'post', :class => "issue-1-watcher icon icon-fav"
64 "/watchers/watch?object_id=1&object_type=issue",
65 :remote => true, :method => 'delete', :class => "issue-1-watcher icon icon-fav"
66 66 )
67 67 assert_equal expected, watcher_link(Issue.find(1), User.find(1))
68 68 end
69 69 end
General Comments 0
You need to be logged in to leave comments. Login now