##// END OF EJS Templates
remove trailing white-spaces from test/functional/issue_relations_controller_test.rb....
Toshi MARUYAMA -
r6787:a611039e2719
parent child
Show More
@@ -5,12 +5,12
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.
@@ -34,27 +34,27 class IssueRelationsControllerTest < ActionController::TestCase
34 :enabled_modules,
34 :enabled_modules,
35 :enumerations,
35 :enumerations,
36 :trackers
36 :trackers
37
37
38 def setup
38 def setup
39 @controller = IssueRelationsController.new
39 @controller = IssueRelationsController.new
40 @request = ActionController::TestRequest.new
40 @request = ActionController::TestRequest.new
41 @response = ActionController::TestResponse.new
41 @response = ActionController::TestResponse.new
42 User.current = nil
42 User.current = nil
43 end
43 end
44
44
45 def test_create
45 def test_create
46 assert_difference 'IssueRelation.count' do
46 assert_difference 'IssueRelation.count' do
47 @request.session[:user_id] = 3
47 @request.session[:user_id] = 3
48 post :create, :issue_id => 1,
48 post :create, :issue_id => 1,
49 :relation => {:issue_to_id => '2', :relation_type => 'relates', :delay => ''}
49 :relation => {:issue_to_id => '2', :relation_type => 'relates', :delay => ''}
50 end
50 end
51 end
51 end
52
52
53 def test_create_xhr
53 def test_create_xhr
54 assert_difference 'IssueRelation.count' do
54 assert_difference 'IssueRelation.count' do
55 @request.session[:user_id] = 3
55 @request.session[:user_id] = 3
56 xhr :post, :create,
56 xhr :post, :create,
57 :issue_id => 3,
57 :issue_id => 3,
58 :relation => {:issue_to_id => '1', :relation_type => 'relates', :delay => ''}
58 :relation => {:issue_to_id => '1', :relation_type => 'relates', :delay => ''}
59 assert_select_rjs 'relations' do
59 assert_select_rjs 'relations' do
60 assert_select 'table', 1
60 assert_select 'table', 1
@@ -62,51 +62,51 class IssueRelationsControllerTest < ActionController::TestCase
62 end
62 end
63 end
63 end
64 end
64 end
65
65
66 def test_create_should_accept_id_with_hash
66 def test_create_should_accept_id_with_hash
67 assert_difference 'IssueRelation.count' do
67 assert_difference 'IssueRelation.count' do
68 @request.session[:user_id] = 3
68 @request.session[:user_id] = 3
69 post :create, :issue_id => 1,
69 post :create, :issue_id => 1,
70 :relation => {:issue_to_id => '#2', :relation_type => 'relates', :delay => ''}
70 :relation => {:issue_to_id => '#2', :relation_type => 'relates', :delay => ''}
71 end
71 end
72 end
72 end
73
73
74 def test_create_should_not_break_with_non_numerical_id
74 def test_create_should_not_break_with_non_numerical_id
75 assert_no_difference 'IssueRelation.count' do
75 assert_no_difference 'IssueRelation.count' do
76 assert_nothing_raised do
76 assert_nothing_raised do
77 @request.session[:user_id] = 3
77 @request.session[:user_id] = 3
78 post :create, :issue_id => 1,
78 post :create, :issue_id => 1,
79 :relation => {:issue_to_id => 'foo', :relation_type => 'relates', :delay => ''}
79 :relation => {:issue_to_id => 'foo', :relation_type => 'relates', :delay => ''}
80 end
80 end
81 end
81 end
82 end
82 end
83
83
84 def test_should_create_relations_with_visible_issues_only
84 def test_should_create_relations_with_visible_issues_only
85 Setting.cross_project_issue_relations = '1'
85 Setting.cross_project_issue_relations = '1'
86 assert_nil Issue.visible(User.find(3)).find_by_id(4)
86 assert_nil Issue.visible(User.find(3)).find_by_id(4)
87
87
88 assert_no_difference 'IssueRelation.count' do
88 assert_no_difference 'IssueRelation.count' do
89 @request.session[:user_id] = 3
89 @request.session[:user_id] = 3
90 post :create, :issue_id => 1,
90 post :create, :issue_id => 1,
91 :relation => {:issue_to_id => '4', :relation_type => 'relates', :delay => ''}
91 :relation => {:issue_to_id => '4', :relation_type => 'relates', :delay => ''}
92 end
92 end
93 end
93 end
94
94
95 should "prevent relation creation when there's a circular dependency"
95 should "prevent relation creation when there's a circular dependency"
96
96
97 def test_destroy
97 def test_destroy
98 assert_difference 'IssueRelation.count', -1 do
98 assert_difference 'IssueRelation.count', -1 do
99 @request.session[:user_id] = 3
99 @request.session[:user_id] = 3
100 delete :destroy, :id => '2'
100 delete :destroy, :id => '2'
101 end
101 end
102 end
102 end
103
103
104 def test_destroy_xhr
104 def test_destroy_xhr
105 IssueRelation.create!(:relation_type => IssueRelation::TYPE_RELATES) do |r|
105 IssueRelation.create!(:relation_type => IssueRelation::TYPE_RELATES) do |r|
106 r.issue_from_id = 3
106 r.issue_from_id = 3
107 r.issue_to_id = 1
107 r.issue_to_id = 1
108 end
108 end
109
109
110 assert_difference 'IssueRelation.count', -1 do
110 assert_difference 'IssueRelation.count', -1 do
111 @request.session[:user_id] = 3
111 @request.session[:user_id] = 3
112 xhr :delete, :destroy, :id => '2'
112 xhr :delete, :destroy, :id => '2'
General Comments 0
You need to be logged in to leave comments. Login now