crumbs 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,242 +8,471 @@ class WithoutLastTest < ActionDispatch::IntegrationTest
8
8
 
9
9
  test 'last request in same path' do
10
10
  get '/'
11
- assert_equal [
12
- { base_url: 'http://www.example.com', path: '/', fullpath: '/' }
13
- ], session[:referers]
14
- assert_select 'a', false
15
-
11
+ assert_equal(
12
+ [
13
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/' }
14
+ ],
15
+ session[:referers]
16
+ )
17
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
18
+ assert_select 'a', 0
19
+ else
20
+ assert_select 'a', false
21
+ end
22
+
16
23
  get '/static'
17
- assert_equal [
18
- { base_url: 'http://www.example.com', path: '/', fullpath: '/' },
19
- { base_url: 'http://www.example.com', path: '/static', fullpath: '/static' }
20
- ], session[:referers]
21
- assert_select 'a', count: 1
22
- assert_select 'a[href="/"]', 'Home'
24
+ assert_equal(
25
+ [
26
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/' },
27
+ { base_url: 'http://www.example.com', path: '/static', fullpath: '/static' }
28
+ ],
29
+ session[:referers]
30
+ )
31
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
32
+ assert_select 'a', 1
33
+ assert_select 'a[href="/"]:contains("Home")'
34
+ else
35
+ assert_select 'a', count: 1
36
+ assert_select 'a[href="/"]', 'Home'
37
+ end
23
38
 
24
39
  get '/static/nested'
25
- assert_equal [
26
- { base_url: 'http://www.example.com', path: '/', fullpath: '/' },
27
- { base_url: 'http://www.example.com', path: '/static', fullpath: '/static' },
28
- { base_url: 'http://www.example.com', path: '/static/nested', fullpath: '/static/nested' }
29
- ], session[:referers]
30
- assert_select 'a', count: 2
31
- assert_select 'a[href="/"]', 'Home'
32
- assert_select 'a[href="/static"]', 'Static'
40
+ assert_equal(
41
+ [
42
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/' },
43
+ { base_url: 'http://www.example.com', path: '/static', fullpath: '/static' },
44
+ { base_url: 'http://www.example.com', path: '/static/nested', fullpath: '/static/nested' }
45
+ ],
46
+ session[:referers]
47
+ )
48
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
49
+ assert_select 'a', 2
50
+ assert_select 'a[href="/"]:contains("Home")'
51
+ assert_select 'a[href="/static"]:contains("Static")'
52
+ else
53
+ assert_select 'a', count: 2
54
+ assert_select 'a[href="/"]', 'Home'
55
+ assert_select 'a[href="/static"]', 'Static'
56
+ end
33
57
 
34
58
  get '/'
35
- assert_equal [
36
- { base_url: 'http://www.example.com', path: '/', fullpath: '/' }
37
- ], session[:referers]
38
- assert_select 'a', false
59
+ assert_equal(
60
+ [
61
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/' }
62
+ ],
63
+ session[:referers]
64
+ )
65
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
66
+ assert_select 'a', 0
67
+ else
68
+ assert_select 'a', false
69
+ end
39
70
  end
40
71
 
41
72
  test 'remember last request with parameters in the same path' do
42
73
  get '/?p1=p1'
43
- assert_equal [
44
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
45
- ], session[:referers]
46
- assert_select 'a', false
47
-
74
+ assert_equal(
75
+ [
76
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
77
+ ],
78
+ session[:referers]
79
+ )
80
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
81
+ assert_select 'a', 0
82
+ else
83
+ assert_select 'a', false
84
+ end
85
+
48
86
  get '/static?p2=p2'
49
- assert_equal [
50
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
51
- { base_url: 'http://www.example.com', path: '/static', fullpath: '/static?p2=p2' }
52
- ], session[:referers]
53
- assert_select 'a', count: 1
54
- assert_select 'a[href="/?p1=p1"]', 'Home'
87
+ assert_equal(
88
+ [
89
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
90
+ { base_url: 'http://www.example.com', path: '/static', fullpath: '/static?p2=p2' }
91
+ ],
92
+ session[:referers]
93
+ )
94
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
95
+ assert_select 'a', 1
96
+ assert_select 'a[href="/?p1=p1"]:contains("Home")'
97
+ else
98
+ assert_select 'a', count: 1
99
+ assert_select 'a[href="/?p1=p1"]', 'Home'
100
+ end
55
101
 
56
102
  get '/static/nested?p3=p3'
57
- assert_equal [
58
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
59
- { base_url: 'http://www.example.com', path: '/static', fullpath: '/static?p2=p2' },
60
- { base_url: 'http://www.example.com', path: '/static/nested', fullpath: '/static/nested?p3=p3' }
61
- ], session[:referers]
62
- assert_select 'a', count: 2
63
- assert_select 'a[href="/?p1=p1"]', 'Home'
64
- assert_select 'a[href="/static?p2=p2"]', 'Static'
103
+ assert_equal(
104
+ [
105
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
106
+ { base_url: 'http://www.example.com', path: '/static', fullpath: '/static?p2=p2' },
107
+ { base_url: 'http://www.example.com', path: '/static/nested', fullpath: '/static/nested?p3=p3' }
108
+ ],
109
+ session[:referers]
110
+ )
111
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
112
+ assert_select 'a', 2
113
+ assert_select 'a[href="/?p1=p1"]:contains("Home")'
114
+ assert_select 'a[href="/static?p2=p2"]:contains("Static")'
115
+ else
116
+ assert_select 'a', count: 2
117
+ assert_select 'a[href="/?p1=p1"]', 'Home'
118
+ assert_select 'a[href="/static?p2=p2"]', 'Static'
119
+ end
65
120
 
66
121
  get '/'
67
- assert_equal [
68
- { base_url: 'http://www.example.com', path: '/', fullpath: '/' }
69
- ], session[:referers]
70
- assert_select 'a', false
122
+ assert_equal(
123
+ [
124
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/' }
125
+ ],
126
+ session[:referers]
127
+ )
128
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
129
+ assert_select 'a', 0
130
+ else
131
+ assert_select 'a', false
132
+ end
71
133
  end
72
134
 
73
135
  test 'gaps not cause any error and generate crumbs either' do
74
136
  get '/?p1=p1'
75
- assert_equal [
76
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
77
- ], session[:referers]
78
- assert_select 'a', false
79
-
137
+ assert_equal(
138
+ [
139
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
140
+ ],
141
+ session[:referers]
142
+ )
143
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
144
+ assert_select 'a', 0
145
+ else
146
+ assert_select 'a', false
147
+ end
148
+
80
149
  get '/static/nested?p3=p3'
81
- assert_equal [
82
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
83
- { base_url: 'http://www.example.com', path: '/static/nested', fullpath: '/static/nested?p3=p3' }
84
- ], session[:referers]
85
- assert_select 'a', count: 2
86
- assert_select 'a[href="/?p1=p1"]', 'Home'
87
- assert_select 'a[href="/static"]', 'Static'
150
+ assert_equal(
151
+ [
152
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
153
+ { base_url: 'http://www.example.com', path: '/static/nested', fullpath: '/static/nested?p3=p3' }
154
+ ],
155
+ session[:referers]
156
+ )
157
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
158
+ assert_select 'a', 2
159
+ assert_select 'a[href="/?p1=p1"]:contains("Home")'
160
+ assert_select 'a[href="/static"]:contains("Static")'
161
+ else
162
+ assert_select 'a', count: 2
163
+ assert_select 'a[href="/?p1=p1"]', 'Home'
164
+ assert_select 'a[href="/static"]', 'Static'
165
+ end
88
166
 
89
167
  get '/'
90
- assert_equal [
91
- { base_url: 'http://www.example.com', path: '/', fullpath: '/' }
92
- ], session[:referers]
93
- assert_select 'a', false
168
+ assert_equal(
169
+ [
170
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/' }
171
+ ],
172
+ session[:referers]
173
+ )
174
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
175
+ assert_select 'a', 0
176
+ else
177
+ assert_select 'a', false
178
+ end
94
179
  end
95
180
 
96
181
  test 'empty crumbs not cause any error and not generate crumbs' do
97
182
  get '/?p1=p1'
98
- assert_equal [
99
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
100
- ], session[:referers]
101
- assert_select 'a', false
183
+ assert_equal(
184
+ [
185
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
186
+ ],
187
+ session[:referers]
188
+ )
189
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
190
+ assert_select 'a', 0
191
+ else
192
+ assert_select 'a', false
193
+ end
102
194
 
103
195
  get '/empty?p2=p2'
104
- assert_equal [
105
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
106
- { base_url: 'http://www.example.com', path: '/empty', fullpath: '/empty?p2=p2' }
107
- ], session[:referers]
108
- assert_select 'a', count: 1
109
- assert_select 'a[href="/?p1=p1"]', 'Home'
196
+ assert_equal(
197
+ [
198
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
199
+ { base_url: 'http://www.example.com', path: '/empty', fullpath: '/empty?p2=p2' }
200
+ ],
201
+ session[:referers]
202
+ )
203
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
204
+ assert_select 'a', 1
205
+ assert_select 'a[href="/?p1=p1"]:contains("Home")'
206
+ else
207
+ assert_select 'a', count: 1
208
+ assert_select 'a[href="/?p1=p1"]', 'Home'
209
+ end
110
210
 
111
211
  get '/empty/nested?p3=p3'
112
- assert_equal [
113
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
114
- { base_url: 'http://www.example.com', path: '/empty', fullpath: '/empty?p2=p2' },
115
- { base_url: 'http://www.example.com', path: '/empty/nested', fullpath: '/empty/nested?p3=p3' }
116
- ], session[:referers]
117
- assert_select 'a', count: 1
118
- assert_select 'a[href="/?p1=p1"]', 'Home'
212
+ assert_equal(
213
+ [
214
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
215
+ { base_url: 'http://www.example.com', path: '/empty', fullpath: '/empty?p2=p2' },
216
+ { base_url: 'http://www.example.com', path: '/empty/nested', fullpath: '/empty/nested?p3=p3' }
217
+ ],
218
+ session[:referers]
219
+ )
220
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
221
+ assert_select 'a', 1
222
+ assert_select 'a[href="/?p1=p1"]:contains("Home")'
223
+ else
224
+ assert_select 'a', count: 1
225
+ assert_select 'a[href="/?p1=p1"]', 'Home'
226
+ end
119
227
 
120
228
  get '/'
121
- assert_equal [
122
- { base_url: 'http://www.example.com', path: '/', fullpath: '/' }
123
- ], session[:referers]
124
- assert_select 'a', false
229
+ assert_equal(
230
+ [
231
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/' }
232
+ ],
233
+ session[:referers]
234
+ )
235
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
236
+ assert_select 'a', 0
237
+ else
238
+ assert_select 'a', false
239
+ end
125
240
  end
126
241
 
127
242
  test 'params not cause any error and can be use alter crumb name' do
128
243
  get '/?p1=p1'
129
- assert_equal [
130
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
131
- ], session[:referers]
132
- assert_select 'a', false
133
-
244
+ assert_equal(
245
+ [
246
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
247
+ ],
248
+ session[:referers]
249
+ )
250
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
251
+ assert_select 'a', 0
252
+ else
253
+ assert_select 'a', false
254
+ end
255
+
134
256
  get '/param?p2=p2'
135
- assert_equal [
136
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
137
- { base_url: 'http://www.example.com', path: '/param', fullpath: '/param?p2=p2' }
138
- ], session[:referers]
139
- assert_select 'a', count: 1
140
- assert_select 'a[href="/?p1=p1"]', 'Home'
257
+ assert_equal(
258
+ [
259
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
260
+ { base_url: 'http://www.example.com', path: '/param', fullpath: '/param?p2=p2' }
261
+ ],
262
+ session[:referers]
263
+ )
264
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
265
+ assert_select 'a', 1
266
+ assert_select 'a[href="/?p1=p1"]:contains("Home")'
267
+ else
268
+ assert_select 'a', count: 1
269
+ assert_select 'a[href="/?p1=p1"]', 'Home'
270
+ end
141
271
 
142
272
  get '/param/1?p3=p3'
143
- assert_equal [
144
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
145
- { base_url: 'http://www.example.com', path: '/param', fullpath: '/param?p2=p2' },
146
- { base_url: 'http://www.example.com', path: '/param/1', fullpath: '/param/1?p3=p3' }
147
- ], session[:referers]
148
- assert_select 'a', count: 2
149
- assert_select 'a[href="/?p1=p1"]', 'Home'
150
- assert_select 'a[href="/param?p2=p2"]', 'Param'
273
+ assert_equal(
274
+ [
275
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
276
+ { base_url: 'http://www.example.com', path: '/param', fullpath: '/param?p2=p2' },
277
+ { base_url: 'http://www.example.com', path: '/param/1', fullpath: '/param/1?p3=p3' }
278
+ ],
279
+ session[:referers]
280
+ )
281
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
282
+ assert_select 'a', 2
283
+ assert_select 'a[href="/?p1=p1"]:contains("Home")'
284
+ assert_select 'a[href="/param?p2=p2"]:contains("Param")'
285
+ else
286
+ assert_select 'a', count: 2
287
+ assert_select 'a[href="/?p1=p1"]', 'Home'
288
+ assert_select 'a[href="/param?p2=p2"]', 'Param'
289
+ end
151
290
 
152
291
  get '/param/1/nested?p4=p4'
153
- assert_equal [
154
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
155
- { base_url: 'http://www.example.com', path: '/param', fullpath: '/param?p2=p2' },
156
- { base_url: 'http://www.example.com', path: '/param/1', fullpath: '/param/1?p3=p3' },
157
- { base_url: 'http://www.example.com', path: '/param/1/nested', fullpath: '/param/1/nested?p4=p4' }
158
- ], session[:referers]
159
- assert_select 'a', count: 3
160
- assert_select 'a[href="/?p1=p1"]', 'Home'
161
- assert_select 'a[href="/param?p2=p2"]', 'Param'
162
- assert_select 'a[href="/param/1?p3=p3"]', 'Param1'
292
+ assert_equal(
293
+ [
294
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
295
+ { base_url: 'http://www.example.com', path: '/param', fullpath: '/param?p2=p2' },
296
+ { base_url: 'http://www.example.com', path: '/param/1', fullpath: '/param/1?p3=p3' },
297
+ { base_url: 'http://www.example.com', path: '/param/1/nested', fullpath: '/param/1/nested?p4=p4' }
298
+ ],
299
+ session[:referers]
300
+ )
301
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
302
+ assert_select 'a', 3
303
+ assert_select 'a[href="/?p1=p1"]:contains("Home")'
304
+ assert_select 'a[href="/param?p2=p2"]:contains("Param")'
305
+ assert_select 'a[href="/param/1?p3=p3"]:contains("Param1")'
306
+ else
307
+ assert_select 'a', count: 3
308
+ assert_select 'a[href="/?p1=p1"]', 'Home'
309
+ assert_select 'a[href="/param?p2=p2"]', 'Param'
310
+ assert_select 'a[href="/param/1?p3=p3"]', 'Param1'
311
+ end
163
312
 
164
313
  get '/'
165
- assert_equal [
166
- { base_url: 'http://www.example.com', path: '/', fullpath: '/' }
167
- ], session[:referers]
168
- assert_select 'a', false
314
+ assert_equal(
315
+ [
316
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/' }
317
+ ],
318
+ session[:referers]
319
+ )
320
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
321
+ assert_select 'a', 0
322
+ else
323
+ assert_select 'a', false
324
+ end
169
325
  end
170
326
 
171
327
  test 'going back not cause any error and retain history' do
172
328
  get '/?p1=p1'
173
- assert_equal [
174
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
175
- ], session[:referers]
176
- assert_select 'a', false
177
-
329
+ assert_equal(
330
+ [
331
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
332
+ ],
333
+ session[:referers]
334
+ )
335
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
336
+ assert_select 'a', 0
337
+ else
338
+ assert_select 'a', false
339
+ end
340
+
178
341
  get '/param?p2=p2'
179
- assert_equal [
180
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
181
- { base_url: 'http://www.example.com', path: '/param', fullpath: '/param?p2=p2' }
182
- ], session[:referers]
183
- assert_select 'a', count: 1
184
- assert_select 'a[href="/?p1=p1"]', 'Home'
342
+ assert_equal(
343
+ [
344
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
345
+ { base_url: 'http://www.example.com', path: '/param', fullpath: '/param?p2=p2' }
346
+ ],
347
+ session[:referers]
348
+ )
349
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
350
+ assert_select 'a', 1
351
+ assert_select 'a[href="/?p1=p1"]:contains("Home")'
352
+ else
353
+ assert_select 'a', count: 1
354
+ assert_select 'a[href="/?p1=p1"]', 'Home'
355
+ end
185
356
 
186
357
  get '/param/1?p3=p3'
187
- assert_equal [
188
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
189
- { base_url: 'http://www.example.com', path: '/param', fullpath: '/param?p2=p2' },
190
- { base_url: 'http://www.example.com', path: '/param/1', fullpath: '/param/1?p3=p3' }
191
- ], session[:referers]
192
- assert_select 'a', count: 2
193
- assert_select 'a[href="/?p1=p1"]', 'Home'
194
- assert_select 'a[href="/param?p2=p2"]', 'Param'
358
+ assert_equal(
359
+ [
360
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
361
+ { base_url: 'http://www.example.com', path: '/param', fullpath: '/param?p2=p2' },
362
+ { base_url: 'http://www.example.com', path: '/param/1', fullpath: '/param/1?p3=p3' }
363
+ ],
364
+ session[:referers]
365
+ )
366
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
367
+ assert_select 'a', 2
368
+ assert_select 'a[href="/?p1=p1"]:contains("Home")'
369
+ assert_select 'a[href="/param?p2=p2"]:contains("Param")'
370
+ else
371
+ assert_select 'a', count: 2
372
+ assert_select 'a[href="/?p1=p1"]', 'Home'
373
+ assert_select 'a[href="/param?p2=p2"]', 'Param'
374
+ end
195
375
 
196
376
  get '/param/1/nested?p4=p4'
197
- assert_equal [
198
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
199
- { base_url: 'http://www.example.com', path: '/param', fullpath: '/param?p2=p2' },
200
- { base_url: 'http://www.example.com', path: '/param/1', fullpath: '/param/1?p3=p3' },
201
- { base_url: 'http://www.example.com', path: '/param/1/nested', fullpath: '/param/1/nested?p4=p4' }
202
- ], session[:referers]
203
- assert_select 'a', count: 3
204
- assert_select 'a[href="/?p1=p1"]', 'Home'
205
- assert_select 'a[href="/param?p2=p2"]', 'Param'
206
- assert_select 'a[href="/param/1?p3=p3"]', 'Param1'
377
+ assert_equal(
378
+ [
379
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
380
+ { base_url: 'http://www.example.com', path: '/param', fullpath: '/param?p2=p2' },
381
+ { base_url: 'http://www.example.com', path: '/param/1', fullpath: '/param/1?p3=p3' },
382
+ { base_url: 'http://www.example.com', path: '/param/1/nested', fullpath: '/param/1/nested?p4=p4' }
383
+ ],
384
+ session[:referers]
385
+ )
386
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
387
+ assert_select 'a', 3
388
+ assert_select 'a[href="/?p1=p1"]:contains("Home")'
389
+ assert_select 'a[href="/param?p2=p2"]:contains("Param")'
390
+ assert_select 'a[href="/param/1?p3=p3"]:contains("Param1")'
391
+ else
392
+ assert_select 'a', count: 3
393
+ assert_select 'a[href="/?p1=p1"]', 'Home'
394
+ assert_select 'a[href="/param?p2=p2"]', 'Param'
395
+ assert_select 'a[href="/param/1?p3=p3"]', 'Param1'
396
+ end
207
397
 
208
398
  get '/param'
209
- assert_equal [
210
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
211
- { base_url: 'http://www.example.com', path: '/param', fullpath: '/param' }
212
- ], session[:referers]
213
- assert_select 'a', count: 1
214
- assert_select 'a[href="/?p1=p1"]', 'Home'
399
+ assert_equal(
400
+ [
401
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
402
+ { base_url: 'http://www.example.com', path: '/param', fullpath: '/param' }
403
+ ],
404
+ session[:referers]
405
+ )
406
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
407
+ assert_select 'a', 1
408
+ assert_select 'a[href="/?p1=p1"]:contains("Home")'
409
+ else
410
+ assert_select 'a', count: 1
411
+ assert_select 'a[href="/?p1=p1"]', 'Home'
412
+ end
215
413
  end
216
414
 
217
415
  test 'translations not cause any error' do
218
416
  get '/?p1=p1'
219
- assert_equal [
220
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
221
- ], session[:referers]
222
- assert_select 'a', false
417
+ assert_equal(
418
+ [
419
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
420
+ ],
421
+ session[:referers]
422
+ )
423
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
424
+ assert_select 'a', 0
425
+ else
426
+ assert_select 'a', false
427
+ end
223
428
 
224
429
  get '/i18n?p2=p2'
225
- assert_equal [
226
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
227
- { base_url: 'http://www.example.com', path: '/i18n', fullpath: '/i18n?p2=p2' }
228
- ], session[:referers]
229
- assert_select 'a', count: 1
230
- assert_select 'a[href="/?p1=p1"]', 'Home'
430
+ assert_equal(
431
+ [
432
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
433
+ { base_url: 'http://www.example.com', path: '/i18n', fullpath: '/i18n?p2=p2' }
434
+ ],
435
+ session[:referers]
436
+ )
437
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
438
+ assert_select 'a', 1
439
+ assert_select 'a[href="/?p1=p1"]:contains("Home")'
440
+ else
441
+ assert_select 'a', count: 1
442
+ assert_select 'a[href="/?p1=p1"]', 'Home'
443
+ end
231
444
 
232
445
  get '/i18n/nested?p3=p3'
233
- assert_equal [
234
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
235
- { base_url: 'http://www.example.com', path: '/i18n', fullpath: '/i18n?p2=p2' },
236
- { base_url: 'http://www.example.com', path: '/i18n/nested', fullpath: '/i18n/nested?p3=p3' }
237
- ], session[:referers]
238
- assert_select 'a', count: 2
239
- assert_select 'a[href="/?p1=p1"]', 'Home'
240
- assert_select 'a[href="/i18n?p2=p2"]', 'Hello world'
446
+ assert_equal(
447
+ [
448
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
449
+ { base_url: 'http://www.example.com', path: '/i18n', fullpath: '/i18n?p2=p2' },
450
+ { base_url: 'http://www.example.com', path: '/i18n/nested', fullpath: '/i18n/nested?p3=p3' }
451
+ ],
452
+ session[:referers]
453
+ )
454
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
455
+ assert_select 'a', 2
456
+ assert_select 'a[href="/?p1=p1"]:contains("Home")'
457
+ assert_select 'a[href="/i18n?p2=p2"]:contains("Hello world")'
458
+ else
459
+ assert_select 'a', count: 2
460
+ assert_select 'a[href="/?p1=p1"]', 'Home'
461
+ assert_select 'a[href="/i18n?p2=p2"]', 'Hello world'
462
+ end
241
463
 
242
464
  get '/?p1=p1'
243
- assert_equal [
244
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
245
- ], session[:referers]
246
- assert_select 'a', false
465
+ assert_equal(
466
+ [
467
+ { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
468
+ ],
469
+ session[:referers]
470
+ )
471
+ if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
472
+ assert_select 'a', 0
473
+ else
474
+ assert_select 'a', false
475
+ end
247
476
  end
248
477
 
249
478
  end