Mercurial > hg > soundsoftware-site
comparison .svn/pristine/b4/b4795ced5acceb3bc06993b762ac31de2976a1c3.svn-base @ 1298:4f746d8966dd redmine_2.3_integration
Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author | Chris Cannam |
---|---|
date | Fri, 14 Jun 2013 09:28:30 +0100 |
parents | 622f24f53b42 |
children |
comparison
equal
deleted
inserted
replaced
1297:0a574315af3e | 1298:4f746d8966dd |
---|---|
1 # Redmine - project management software | |
2 # Copyright (C) 2006-2013 Jean-Philippe Lang | |
3 # | |
4 # This program is free software; you can redistribute it and/or | |
5 # modify it under the terms of the GNU General Public License | |
6 # as published by the Free Software Foundation; either version 2 | |
7 # of the License, or (at your option) any later version. | |
8 # | |
9 # This program is distributed in the hope that it will be useful, | |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 # GNU General Public License for more details. | |
13 # | |
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 | |
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 | |
18 require File.expand_path('../../../test_helper', __FILE__) | |
19 | |
20 class WatchersHelperTest < ActionView::TestCase | |
21 include WatchersHelper | |
22 include Redmine::I18n | |
23 | |
24 fixtures :users, :issues | |
25 | |
26 def setup | |
27 super | |
28 set_language_if_valid('en') | |
29 User.current = nil | |
30 end | |
31 | |
32 test '#watcher_link with a non-watched object' do | |
33 expected = link_to( | |
34 "Watch", | |
35 "/watchers/watch?object_id=1&object_type=issue", | |
36 :remote => true, :method => 'post', :class => "issue-1-watcher icon icon-fav-off" | |
37 ) | |
38 assert_equal expected, watcher_link(Issue.find(1), User.find(1)) | |
39 end | |
40 | |
41 test '#watcher_link with a single objet array' do | |
42 expected = link_to( | |
43 "Watch", | |
44 "/watchers/watch?object_id=1&object_type=issue", | |
45 :remote => true, :method => 'post', :class => "issue-1-watcher icon icon-fav-off" | |
46 ) | |
47 assert_equal expected, watcher_link([Issue.find(1)], User.find(1)) | |
48 end | |
49 | |
50 test '#watcher_link with a multiple objets array' do | |
51 expected = link_to( | |
52 "Watch", | |
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" | |
55 ) | |
56 assert_equal expected, watcher_link([Issue.find(1), Issue.find(3)], User.find(1)) | |
57 end | |
58 | |
59 test '#watcher_link with a watched object' do | |
60 Watcher.create!(:watchable => Issue.find(1), :user => User.find(1)) | |
61 | |
62 expected = link_to( | |
63 "Unwatch", | |
64 "/watchers/watch?object_id=1&object_type=issue", | |
65 :remote => true, :method => 'delete', :class => "issue-1-watcher icon icon-fav" | |
66 ) | |
67 assert_equal expected, watcher_link(Issue.find(1), User.find(1)) | |
68 end | |
69 end |