##// END OF EJS Templates
remove trailing white-spaces from test/integration/issues_test.rb....
Toshi MARUYAMA -
r6534:4b60e577ca03
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.
@@ -18,7 +18,7
18 require File.expand_path('../../test_helper', __FILE__)
18 require File.expand_path('../../test_helper', __FILE__)
19
19
20 class IssuesTest < ActionController::IntegrationTest
20 class IssuesTest < ActionController::IntegrationTest
21 fixtures :projects,
21 fixtures :projects,
22 :users,
22 :users,
23 :roles,
23 :roles,
24 :members,
24 :members,
@@ -38,13 +38,13 class IssuesTest < ActionController::IntegrationTest
38 get 'projects/1/issues/new', :tracker_id => '1'
38 get 'projects/1/issues/new', :tracker_id => '1'
39 assert_response :success
39 assert_response :success
40 assert_template 'issues/new'
40 assert_template 'issues/new'
41
41
42 post 'projects/1/issues', :tracker_id => "1",
42 post 'projects/1/issues', :tracker_id => "1",
43 :issue => { :start_date => "2006-12-26",
43 :issue => { :start_date => "2006-12-26",
44 :priority_id => "4",
44 :priority_id => "4",
45 :subject => "new test issue",
45 :subject => "new test issue",
46 :category_id => "",
46 :category_id => "",
47 :description => "new issue",
47 :description => "new issue",
48 :done_ratio => "0",
48 :done_ratio => "0",
49 :due_date => "",
49 :due_date => "",
50 :assigned_to_id => "" },
50 :assigned_to_id => "" },
@@ -58,7 +58,7 class IssuesTest < ActionController::IntegrationTest
58 follow_redirect!
58 follow_redirect!
59 assert_equal issue, assigns(:issue)
59 assert_equal issue, assigns(:issue)
60
60
61 # check issue attributes
61 # check issue attributes
62 assert_equal 'jsmith', issue.author.login
62 assert_equal 'jsmith', issue.author.login
63 assert_equal 1, issue.project.id
63 assert_equal 1, issue.project.id
64 assert_equal 1, issue.status.id
64 assert_equal 1, issue.status.id
@@ -73,7 +73,7 class IssuesTest < ActionController::IntegrationTest
73 :notes => 'Some notes',
73 :notes => 'Some notes',
74 :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'This is an attachment'}}
74 :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'This is an attachment'}}
75 assert_redirected_to "/issues/1"
75 assert_redirected_to "/issues/1"
76
76
77 # make sure attachment was saved
77 # make sure attachment was saved
78 attachment = Issue.find(1).attachments.find_by_filename("testfile.txt")
78 attachment = Issue.find(1).attachments.find_by_filename("testfile.txt")
79 assert_kind_of Attachment, attachment
79 assert_kind_of Attachment, attachment
@@ -83,56 +83,56 class IssuesTest < ActionController::IntegrationTest
83 #assert_equal file_data_1.length, attachment.filesize
83 #assert_equal file_data_1.length, attachment.filesize
84 # verify that the attachment was written to disk
84 # verify that the attachment was written to disk
85 assert File.exist?(attachment.diskfile)
85 assert File.exist?(attachment.diskfile)
86
86
87 # remove the attachments
87 # remove the attachments
88 Issue.find(1).attachments.each(&:destroy)
88 Issue.find(1).attachments.each(&:destroy)
89 assert_equal 0, Issue.find(1).attachments.length
89 assert_equal 0, Issue.find(1).attachments.length
90 end
90 end
91
91
92 def test_other_formats_links_on_get_index
92 def test_other_formats_links_on_get_index
93 get '/projects/ecookbook/issues'
93 get '/projects/ecookbook/issues'
94
94
95 %w(Atom PDF CSV).each do |format|
95 %w(Atom PDF CSV).each do |format|
96 assert_tag :a, :content => format,
96 assert_tag :a, :content => format,
97 :attributes => { :href => "/projects/ecookbook/issues.#{format.downcase}",
97 :attributes => { :href => "/projects/ecookbook/issues.#{format.downcase}",
98 :rel => 'nofollow' }
98 :rel => 'nofollow' }
99 end
99 end
100 end
100 end
101
101
102 def test_other_formats_links_on_post_index_without_project_id_in_url
102 def test_other_formats_links_on_post_index_without_project_id_in_url
103 post '/issues', :project_id => 'ecookbook'
103 post '/issues', :project_id => 'ecookbook'
104
104
105 %w(Atom PDF CSV).each do |format|
105 %w(Atom PDF CSV).each do |format|
106 assert_tag :a, :content => format,
106 assert_tag :a, :content => format,
107 :attributes => { :href => "/projects/ecookbook/issues.#{format.downcase}",
107 :attributes => { :href => "/projects/ecookbook/issues.#{format.downcase}",
108 :rel => 'nofollow' }
108 :rel => 'nofollow' }
109 end
109 end
110 end
110 end
111
111
112 def test_pagination_links_on_get_index
112 def test_pagination_links_on_get_index
113 Setting.per_page_options = '2'
113 Setting.per_page_options = '2'
114 get '/projects/ecookbook/issues'
114 get '/projects/ecookbook/issues'
115
115
116 assert_tag :a, :content => '2',
116 assert_tag :a, :content => '2',
117 :attributes => { :href => '/projects/ecookbook/issues?page=2' }
117 :attributes => { :href => '/projects/ecookbook/issues?page=2' }
118
118
119 end
119 end
120
120
121 def test_pagination_links_on_post_index_without_project_id_in_url
121 def test_pagination_links_on_post_index_without_project_id_in_url
122 Setting.per_page_options = '2'
122 Setting.per_page_options = '2'
123 post '/issues', :project_id => 'ecookbook'
123 post '/issues', :project_id => 'ecookbook'
124
124
125 assert_tag :a, :content => '2',
125 assert_tag :a, :content => '2',
126 :attributes => { :href => '/projects/ecookbook/issues?page=2' }
126 :attributes => { :href => '/projects/ecookbook/issues?page=2' }
127
127
128 end
128 end
129
129
130 def test_issue_with_user_custom_field
130 def test_issue_with_user_custom_field
131 @field = IssueCustomField.create!(:name => 'Tester', :field_format => 'user', :is_for_all => true, :trackers => Tracker.all)
131 @field = IssueCustomField.create!(:name => 'Tester', :field_format => 'user', :is_for_all => true, :trackers => Tracker.all)
132 Role.anonymous.add_permission! :add_issues, :edit_issues
132 Role.anonymous.add_permission! :add_issues, :edit_issues
133 users = Project.find(1).users
133 users = Project.find(1).users
134 tester = users.first
134 tester = users.first
135
135
136 # Issue form
136 # Issue form
137 get '/projects/ecookbook/issues/new'
137 get '/projects/ecookbook/issues/new'
138 assert_response :success
138 assert_response :success
@@ -144,10 +144,10 class IssuesTest < ActionController::IntegrationTest
144 :attributes => {:value => tester.id.to_s},
144 :attributes => {:value => tester.id.to_s},
145 :content => tester.name
145 :content => tester.name
146 }
146 }
147
147
148 # Create issue
148 # Create issue
149 assert_difference 'Issue.count' do
149 assert_difference 'Issue.count' do
150 post '/projects/ecookbook/issues',
150 post '/projects/ecookbook/issues',
151 :issue => {
151 :issue => {
152 :tracker_id => '1',
152 :tracker_id => '1',
153 :priority_id => '4',
153 :priority_id => '4',
@@ -157,7 +157,7 class IssuesTest < ActionController::IntegrationTest
157 end
157 end
158 issue = Issue.first(:order => 'id DESC')
158 issue = Issue.first(:order => 'id DESC')
159 assert_response 302
159 assert_response 302
160
160
161 # Issue view
161 # Issue view
162 follow_redirect!
162 follow_redirect!
163 assert_tag :th,
163 assert_tag :th,
@@ -174,7 +174,7 class IssuesTest < ActionController::IntegrationTest
174 :attributes => {:value => tester.id.to_s, :selected => 'selected'},
174 :attributes => {:value => tester.id.to_s, :selected => 'selected'},
175 :content => tester.name
175 :content => tester.name
176 }
176 }
177
177
178 # Update issue
178 # Update issue
179 new_tester = users[1]
179 new_tester = users[1]
180 assert_difference 'Journal.count' do
180 assert_difference 'Journal.count' do
@@ -185,7 +185,7 class IssuesTest < ActionController::IntegrationTest
185 }
185 }
186 end
186 end
187 assert_response 302
187 assert_response 302
188
188
189 # Issue view
189 # Issue view
190 follow_redirect!
190 follow_redirect!
191 assert_tag :content => 'Tester',
191 assert_tag :content => 'Tester',
General Comments 0
You need to be logged in to leave comments. Login now