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