##// END OF EJS Templates
make WatchersHelperTest passes when config.threadsafe! is enabled (#12097)...
Toshi MARUYAMA -
r12153:637e450824cf
parent child
Show More
@@ -1,69 +1,70
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 include Rails.application.routes.url_helpers
23 24
24 25 fixtures :users, :issues
25 26
26 27 def setup
27 28 super
28 29 set_language_if_valid('en')
29 30 User.current = nil
30 31 end
31 32
32 33 test '#watcher_link with a non-watched object' do
33 34 expected = link_to(
34 35 "Watch",
35 36 "/watchers/watch?object_id=1&object_type=issue",
36 37 :remote => true, :method => 'post', :class => "issue-1-watcher icon icon-fav-off"
37 38 )
38 39 assert_equal expected, watcher_link(Issue.find(1), User.find(1))
39 40 end
40 41
41 42 test '#watcher_link with a single objet array' do
42 43 expected = link_to(
43 44 "Watch",
44 45 "/watchers/watch?object_id=1&object_type=issue",
45 46 :remote => true, :method => 'post', :class => "issue-1-watcher icon icon-fav-off"
46 47 )
47 48 assert_equal expected, watcher_link([Issue.find(1)], User.find(1))
48 49 end
49 50
50 51 test '#watcher_link with a multiple objets array' do
51 52 expected = link_to(
52 53 "Watch",
53 54 "/watchers/watch?object_id%5B%5D=1&object_id%5B%5D=3&object_type=issue",
54 55 :remote => true, :method => 'post', :class => "issue-bulk-watcher icon icon-fav-off"
55 56 )
56 57 assert_equal expected, watcher_link([Issue.find(1), Issue.find(3)], User.find(1))
57 58 end
58 59
59 60 test '#watcher_link with a watched object' do
60 61 Watcher.create!(:watchable => Issue.find(1), :user => User.find(1))
61 62
62 63 expected = link_to(
63 64 "Unwatch",
64 65 "/watchers/watch?object_id=1&object_type=issue",
65 66 :remote => true, :method => 'delete', :class => "issue-1-watcher icon icon-fav"
66 67 )
67 68 assert_equal expected, watcher_link(Issue.find(1), User.find(1))
68 69 end
69 70 end
General Comments 0
You need to be logged in to leave comments. Login now