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