@@ -33,31 +33,39 @@ def setup
33
33
super
34
34
User . current = nil
35
35
@project = Project . find ( PRJ_ID )
36
- @repository = Repository ::Bazaar . create (
37
- :project => @project ,
38
- :url => REPOSITORY_PATH_TRUNK ,
39
- :log_encoding => 'UTF-8' )
36
+ @repository =
37
+ Repository ::Bazaar . create (
38
+ :project => @project ,
39
+ :url => REPOSITORY_PATH_TRUNK ,
40
+ :log_encoding => 'UTF-8'
41
+ )
40
42
assert @repository
41
43
end
42
44
43
45
if File . directory? ( REPOSITORY_PATH )
44
46
def test_get_new
45
47
@request . session [ :user_id ] = 1
46
48
@project . repository . destroy
47
- get :new , :params => {
49
+ get (
50
+ :new ,
51
+ :params => {
48
52
:project_id => 'subproject1' ,
49
53
:repository_scm => 'Bazaar'
50
54
}
55
+ )
51
56
assert_response :success
52
57
assert_select 'select[name=?]' , 'repository_scm' do
53
58
assert_select 'option[value=?][selected=selected]' , 'Bazaar'
54
59
end
55
60
end
56
61
57
62
def test_browse_root
58
- get :show , :params => {
63
+ get (
64
+ :show ,
65
+ :params => {
59
66
:id => PRJ_ID
60
67
}
68
+ )
61
69
assert_response :success
62
70
assert_select 'table.entries tbody' do
63
71
assert_select 'tr' , 2
@@ -67,11 +75,14 @@ def test_browse_root
67
75
end
68
76
69
77
def test_browse_directory
70
- get :show , :params => {
78
+ get (
79
+ :show ,
80
+ :params => {
71
81
:id => PRJ_ID ,
72
82
:repository_id => @repository . id ,
73
83
:path => repository_path_hash ( [ 'directory' ] ) [ :param ]
74
84
}
85
+ )
75
86
assert_response :success
76
87
assert_select 'table.entries tbody' do
77
88
assert_select 'tr' , 3
@@ -82,12 +93,15 @@ def test_browse_directory
82
93
end
83
94
84
95
def test_browse_at_given_revision
85
- get :show , :params => {
96
+ get (
97
+ :show ,
98
+ :params => {
86
99
:id => PRJ_ID ,
87
100
:repository_id => @repository . id ,
88
101
:path => repository_path_hash ( [ ] ) [ :param ] ,
89
102
:rev => 3
90
103
}
104
+ )
91
105
assert_response :success
92
106
assert_select 'table.entries tbody' do
93
107
assert_select 'tr' , 4
@@ -99,69 +113,87 @@ def test_browse_at_given_revision
99
113
end
100
114
101
115
def test_changes
102
- get :changes , :params => {
116
+ get (
117
+ :changes ,
118
+ :params => {
103
119
:id => PRJ_ID ,
104
120
:repository_id => @repository . id ,
105
121
:path => repository_path_hash ( [ 'doc-mkdir.txt' ] ) [ :param ]
106
122
}
123
+ )
107
124
assert_response :success
108
125
assert_select 'h2' , :text => /doc-mkdir.txt/
109
126
end
110
127
111
128
def test_entry_show
112
- get :entry , :params => {
129
+ get (
130
+ :entry ,
131
+ :params => {
113
132
:id => PRJ_ID ,
114
133
:repository_id => @repository . id ,
115
134
:path => repository_path_hash ( [ 'directory' , 'doc-ls.txt' ] ) [ :param ]
116
135
}
136
+ )
117
137
assert_response :success
118
138
# Line 19
119
139
assert_select 'tr#L29 td.line-code' , :text => /Show help message/
120
140
end
121
141
122
142
def test_entry_download
123
- get :entry , :params => {
143
+ get (
144
+ :entry ,
145
+ :params => {
124
146
:id => PRJ_ID ,
125
147
:repository_id => @repository . id ,
126
148
:path => repository_path_hash ( [ 'directory' , 'doc-ls.txt' ] ) [ :param ] ,
127
149
:format => 'raw'
128
150
}
151
+ )
129
152
assert_response :success
130
153
# File content
131
154
assert @response . body . include? ( 'Show help message' )
132
155
end
133
156
134
157
def test_directory_entry
135
- get :entry , :params => {
158
+ get (
159
+ :entry ,
160
+ :params => {
136
161
:id => PRJ_ID ,
137
162
:repository_id => @repository . id ,
138
163
:path => repository_path_hash ( [ 'directory' ] ) [ :param ]
139
164
}
165
+ )
140
166
assert_response :success
141
167
assert_select 'table.entries tbody'
142
168
end
143
169
144
170
def test_diff
145
171
# Full diff of changeset 3
146
172
[ 'inline' , 'sbs' ] . each do |dt |
147
- get :diff , :params => {
173
+ get (
174
+ :diff ,
175
+ :params => {
148
176
:id => PRJ_ID ,
149
177
:repository_id => @repository . id ,
150
178
:rev => 3 ,
151
179
:type => dt
152
180
}
181
+ )
153
182
assert_response :success
154
183
# Line 11 removed
155
184
assert_select 'th.line-num:contains(11) ~ td.diff_out' , :text => /Display more information/
156
185
end
157
186
end
158
187
159
188
def test_annotate
160
- get :annotate , :params => {
189
+ get (
190
+ :annotate ,
191
+ :params => {
161
192
:id => PRJ_ID ,
162
193
:repository_id => @repository . id ,
163
194
:path => repository_path_hash ( [ 'doc-mkdir.txt' ] ) [ :param ]
164
195
}
196
+ )
165
197
assert_response :success
166
198
167
199
assert_select "th.line-num" , :text => '2' do
@@ -176,17 +208,22 @@ def test_annotate
176
208
end
177
209
178
210
def test_annotate_author_escaping
179
- repository = Repository ::Bazaar . create (
180
- :project => @project ,
181
- :url => File . join ( REPOSITORY_PATH , "author_escaping" ) ,
182
- :identifier => 'author_escaping' ,
183
- :log_encoding => 'UTF-8' )
211
+ repository =
212
+ Repository ::Bazaar . create (
213
+ :project => @project ,
214
+ :url => File . join ( REPOSITORY_PATH , "author_escaping" ) ,
215
+ :identifier => 'author_escaping' ,
216
+ :log_encoding => 'UTF-8'
217
+ )
184
218
assert repository
185
- get :annotate , :params => {
219
+ get (
220
+ :annotate ,
221
+ :params => {
186
222
:id => PRJ_ID ,
187
223
:repository_id => 'author_escaping' ,
188
224
:path => repository_path_hash ( [ 'author-escaping-test.txt' ] ) [ :param ]
189
225
}
226
+ )
190
227
assert_response :success
191
228
192
229
assert_select "th.line-num" , :text => '1' do
@@ -207,17 +244,22 @@ def test_annotate_author_non_ascii
207
244
log_encoding = Encoding . locale_charmap
208
245
end
209
246
unless log_encoding . nil?
210
- repository = Repository ::Bazaar . create (
211
- :project => @project ,
212
- :url => File . join ( REPOSITORY_PATH , "author_non_ascii" ) ,
213
- :identifier => 'author_non_ascii' ,
214
- :log_encoding => log_encoding )
247
+ repository =
248
+ Repository ::Bazaar . create (
249
+ :project => @project ,
250
+ :url => File . join ( REPOSITORY_PATH , "author_non_ascii" ) ,
251
+ :identifier => 'author_non_ascii' ,
252
+ :log_encoding => log_encoding
253
+ )
215
254
assert repository
216
- get :annotate , :params => {
255
+ get (
256
+ :annotate ,
257
+ :params => {
217
258
:id => PRJ_ID ,
218
259
:repository_id => 'author_non_ascii' ,
219
260
:path => repository_path_hash ( [ 'author-non-ascii-test.txt' ] ) [ :param ]
220
261
}
262
+ )
221
263
assert_response :success
222
264
223
265
assert_select "th.line-num" , :text => '1' do
@@ -239,9 +281,12 @@ def test_destroy_valid_repository
239
281
assert @repository . changesets . count > 0
240
282
241
283
assert_difference 'Repository.count' , -1 do
242
- delete :destroy , :params => {
284
+ delete (
285
+ :destroy ,
286
+ :params => {
243
287
:id => @repository . id
244
288
}
289
+ )
245
290
end
246
291
assert_response 302
247
292
@project . reload
@@ -251,18 +296,23 @@ def test_destroy_valid_repository
251
296
def test_destroy_invalid_repository
252
297
@request . session [ :user_id ] = 1 # admin
253
298
@project . repository . destroy
254
- @repository = Repository ::Bazaar . create! (
255
- :project => @project ,
256
- :url => "/invalid" ,
257
- :log_encoding => 'UTF-8' )
299
+ @repository =
300
+ Repository ::Bazaar . create! (
301
+ :project => @project ,
302
+ :url => "/invalid" ,
303
+ :log_encoding => 'UTF-8'
304
+ )
258
305
@repository . fetch_changesets
259
306
@repository . reload
260
307
assert_equal 0 , @repository . changesets . count
261
308
262
309
assert_difference 'Repository.count' , -1 do
263
- delete :destroy , :params => {
310
+ delete (
311
+ :destroy ,
312
+ :params => {
264
313
:id => @repository . id
265
314
}
315
+ )
266
316
end
267
317
assert_response 302
268
318
@project . reload
0 commit comments