crumbs 2.1.2 → 4.0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +31 -41
  4. data/Rakefile +1 -14
  5. data/lib/crumbs/definitions.rb +26 -0
  6. data/lib/crumbs/dsl/controller.rb +7 -11
  7. data/lib/crumbs/dsl/namespace.rb +8 -4
  8. data/lib/crumbs/extensions/action_controller/base.rb +43 -0
  9. data/lib/crumbs/proxy.rb +10 -7
  10. data/lib/crumbs/railtie.rb +4 -2
  11. data/lib/crumbs/version.rb +1 -1
  12. data/lib/crumbs.rb +7 -38
  13. data/lib/generators/crumbs/install/install_generator.rb +15 -0
  14. data/test/dummy/Rakefile +1 -2
  15. data/test/dummy/app/assets/javascripts/application.js +2 -2
  16. data/test/dummy/app/assets/stylesheets/application.css +6 -4
  17. data/test/dummy/app/controllers/admin/reports/deliveries_controller.rb +6 -0
  18. data/test/dummy/app/controllers/admin/users_controller.rb +9 -0
  19. data/test/dummy/app/controllers/pages_controller.rb +0 -21
  20. data/test/dummy/app/views/application/_crumbs.html.erb +3 -0
  21. data/test/dummy/app/views/application/index.html.erb +1 -0
  22. data/test/dummy/app/views/application/show.html.erb +1 -0
  23. data/test/dummy/app/views/layouts/application.html.erb +9 -11
  24. data/test/dummy/bin/bundle +1 -0
  25. data/test/dummy/bin/rails +2 -1
  26. data/test/dummy/bin/rake +1 -0
  27. data/test/dummy/bin/setup +30 -0
  28. data/test/dummy/config/application.rb +6 -1
  29. data/test/dummy/config/boot.rb +1 -1
  30. data/test/dummy/config/crumbs.rb +15 -12
  31. data/test/dummy/config/environment.rb +1 -1
  32. data/test/dummy/config/environments/development.rb +14 -5
  33. data/test/dummy/config/environments/production.rb +18 -26
  34. data/test/dummy/config/environments/test.rb +10 -12
  35. data/test/dummy/config/initializers/assets.rb +11 -0
  36. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  37. data/test/dummy/config/initializers/mime_types.rb +1 -2
  38. data/test/dummy/config/initializers/session_store.rb +1 -1
  39. data/test/dummy/config/locales/en.yml +1 -23
  40. data/test/dummy/config/routes.rb +9 -70
  41. data/test/dummy/config/secrets.yml +22 -0
  42. data/test/dummy/config.ru +1 -1
  43. data/test/dummy/log/development.log +0 -0
  44. data/test/dummy/log/test.log +1050 -0
  45. data/test/dummy/public/404.html +58 -55
  46. data/test/dummy/public/422.html +58 -55
  47. data/test/dummy/public/500.html +57 -54
  48. data/test/dummy/tmp/cache/assets/sprockets/v3.0/5L/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
  49. data/test/dummy/tmp/cache/assets/sprockets/v3.0/8e/8eFn-IE_QAK9wkb3vBoqeyKxaN7o1hbJQnrz-uVvvQA.cache +0 -0
  50. data/test/dummy/tmp/cache/assets/sprockets/v3.0/OI/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +2 -0
  51. data/test/dummy/tmp/cache/assets/sprockets/v3.0/RP/RPShcX3Jre4zxu1UEaxs1Tw4slXRjICXTyfQvtEWC7M.cache +0 -0
  52. data/test/dummy/tmp/cache/assets/sprockets/v3.0/SG/SGNGr7AZfBE1q7ev2-YM1G-o0XAZ0pKqbsS3NvHtRcA.cache +1 -0
  53. data/test/dummy/tmp/cache/assets/sprockets/v3.0/fG/fG_uaNK13wisQiji91xNsGecGxX9QhMCF2eSX_aR0G0.cache +1 -0
  54. data/test/dummy/tmp/cache/assets/sprockets/v3.0/gb/gbunrAFVOHPwl2npUgKv_C3f_qiJnZDd9zG5-h3jrpo.cache +1 -0
  55. data/test/dummy/tmp/cache/assets/sprockets/v3.0/hZ/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +2 -0
  56. data/test/dummy/tmp/cache/assets/sprockets/v3.0/mv/mvqN6PphkrOOC8zbUEhpC_9E_4ybdO25MRy_gG6dq3Y.cache +1 -0
  57. data/test/dummy/tmp/cache/assets/sprockets/v3.0/nm/nmcUZlKAIwyJ_35Nm9P8pukLeRX5aApP6NFj5MpNPgc.cache +1 -0
  58. data/test/dummy/tmp/cache/assets/sprockets/v3.0/pE/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +2 -0
  59. data/test/dummy/tmp/cache/assets/sprockets/v3.0/sB/sB6xWxBmgzVC0Co9__ANYrE58lr4WPwiwFa9mswooWM.cache +0 -0
  60. data/test/dummy/tmp/cache/assets/sprockets/v3.0/va/vaNrIny9hchHD9eIJxAicyYLC7qeV4PTh4Nh40_Y6Vg.cache +1 -0
  61. data/test/dummy/tmp/cache/assets/sprockets/v3.0/xd/xdBKQyhEAlDIstGvXw945PWJoEWi23rKuY7elOcWqHc.cache +1 -0
  62. data/test/dummy/tmp/cache/assets/sprockets/v3.0/yv/yv8GQNKBriraHQF7esI3Zifw_OgHI0-bFlUD2nbZ3fw.cache +0 -0
  63. data/test/dummy/tmp/cache/assets/sprockets/v3.0/zn/znrkcru9CbH2razkpdTQATvom11yKHllvnOQyyPSJAo.cache +0 -0
  64. data/test/generator_test.rb +5 -6
  65. data/test/test_helper.rb +4 -13
  66. data/test/view_test.rb +40 -0
  67. metadata +71 -31
  68. data/lib/crumbs/action_controller/base.rb +0 -47
  69. data/lib/generators/crumbs/install_generator.rb +0 -14
  70. data/lib/generators/crumbs/templates/configure.rb +0 -2
  71. data/test/dummy/README.rdoc +0 -28
  72. data/test/dummy/app/controllers/namespace/pages_controller.rb +0 -8
  73. data/test/dummy/app/views/pages/crumbs.html.erb +0 -3
  74. data/test/dummy/config/database.yml +0 -25
  75. data/test/dummy/config/initializers/secret_token.rb +0 -13
  76. data/test/dummy/db/schema.rb +0 -16
  77. data/test/with_last_test.rb +0 -553
  78. data/test/without_last_test.rb +0 -495
  79. /data/lib/generators/crumbs/{templates/define.rb → install/templates/configuration.rb} +0 -0
@@ -1,495 +0,0 @@
1
- require 'test_helper'
2
-
3
- class WithoutLastTest < ActionDispatch::IntegrationTest
4
-
5
- setup do
6
- Crumbs.config.show_last = false
7
- end
8
-
9
- test 'namespaced controller' do
10
- get '/namespaced'
11
- assert_equal(
12
- [
13
- { base_url: 'http://www.example.com', path: '/namespaced', fullpath: '/namespaced' }
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
- end
25
-
26
- test 'last request in same path' do
27
- get '/'
28
- assert_equal(
29
- [
30
- { base_url: 'http://www.example.com', path: '/', fullpath: '/' }
31
- ],
32
- session[:referers]
33
- )
34
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
35
- assert_select 'a', 0
36
- else
37
- assert_select 'a', false
38
- end
39
-
40
- get '/static'
41
- assert_equal(
42
- [
43
- { base_url: 'http://www.example.com', path: '/', fullpath: '/' },
44
- { base_url: 'http://www.example.com', path: '/static', fullpath: '/static' }
45
- ],
46
- session[:referers]
47
- )
48
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
49
- assert_select 'a', 1
50
- assert_select 'a[href="/"]:contains("Home")'
51
- else
52
- assert_select 'a', count: 1
53
- assert_select 'a[href="/"]', 'Home'
54
- end
55
-
56
- get '/static/nested'
57
- assert_equal(
58
- [
59
- { base_url: 'http://www.example.com', path: '/', fullpath: '/' },
60
- { base_url: 'http://www.example.com', path: '/static', fullpath: '/static' },
61
- { base_url: 'http://www.example.com', path: '/static/nested', fullpath: '/static/nested' }
62
- ],
63
- session[:referers]
64
- )
65
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
66
- assert_select 'a', 2
67
- assert_select 'a[href="/"]:contains("Home")'
68
- assert_select 'a[href="/static"]:contains("Static")'
69
- else
70
- assert_select 'a', count: 2
71
- assert_select 'a[href="/"]', 'Home'
72
- assert_select 'a[href="/static"]', 'Static'
73
- end
74
-
75
- get '/'
76
- assert_equal(
77
- [
78
- { base_url: 'http://www.example.com', path: '/', fullpath: '/' }
79
- ],
80
- session[:referers]
81
- )
82
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
83
- assert_select 'a', 0
84
- else
85
- assert_select 'a', false
86
- end
87
- end
88
-
89
- test 'remember last request with parameters in the same path' do
90
- get '/?p1=p1'
91
- assert_equal(
92
- [
93
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
94
- ],
95
- session[:referers]
96
- )
97
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
98
- assert_select 'a', 0
99
- else
100
- assert_select 'a', false
101
- end
102
-
103
- get '/static?p2=p2'
104
- assert_equal(
105
- [
106
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
107
- { base_url: 'http://www.example.com', path: '/static', fullpath: '/static?p2=p2' }
108
- ],
109
- session[:referers]
110
- )
111
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
112
- assert_select 'a', 1
113
- assert_select 'a[href="/?p1=p1"]:contains("Home")'
114
- else
115
- assert_select 'a', count: 1
116
- assert_select 'a[href="/?p1=p1"]', 'Home'
117
- end
118
-
119
- get '/static/nested?p3=p3'
120
- assert_equal(
121
- [
122
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
123
- { base_url: 'http://www.example.com', path: '/static', fullpath: '/static?p2=p2' },
124
- { base_url: 'http://www.example.com', path: '/static/nested', fullpath: '/static/nested?p3=p3' }
125
- ],
126
- session[:referers]
127
- )
128
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
129
- assert_select 'a', 2
130
- assert_select 'a[href="/?p1=p1"]:contains("Home")'
131
- assert_select 'a[href="/static?p2=p2"]:contains("Static")'
132
- else
133
- assert_select 'a', count: 2
134
- assert_select 'a[href="/?p1=p1"]', 'Home'
135
- assert_select 'a[href="/static?p2=p2"]', 'Static'
136
- end
137
-
138
- get '/'
139
- assert_equal(
140
- [
141
- { base_url: 'http://www.example.com', path: '/', fullpath: '/' }
142
- ],
143
- session[:referers]
144
- )
145
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
146
- assert_select 'a', 0
147
- else
148
- assert_select 'a', false
149
- end
150
- end
151
-
152
- test 'gaps not cause any error and generate crumbs either' do
153
- get '/?p1=p1'
154
- assert_equal(
155
- [
156
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
157
- ],
158
- session[:referers]
159
- )
160
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
161
- assert_select 'a', 0
162
- else
163
- assert_select 'a', false
164
- end
165
-
166
- get '/static/nested?p3=p3'
167
- assert_equal(
168
- [
169
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
170
- { base_url: 'http://www.example.com', path: '/static/nested', fullpath: '/static/nested?p3=p3' }
171
- ],
172
- session[:referers]
173
- )
174
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
175
- assert_select 'a', 2
176
- assert_select 'a[href="/?p1=p1"]:contains("Home")'
177
- assert_select 'a[href="/static"]:contains("Static")'
178
- else
179
- assert_select 'a', count: 2
180
- assert_select 'a[href="/?p1=p1"]', 'Home'
181
- assert_select 'a[href="/static"]', 'Static'
182
- end
183
-
184
- get '/'
185
- assert_equal(
186
- [
187
- { base_url: 'http://www.example.com', path: '/', fullpath: '/' }
188
- ],
189
- session[:referers]
190
- )
191
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
192
- assert_select 'a', 0
193
- else
194
- assert_select 'a', false
195
- end
196
- end
197
-
198
- test 'empty crumbs not cause any error and not generate crumbs' do
199
- get '/?p1=p1'
200
- assert_equal(
201
- [
202
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
203
- ],
204
- session[:referers]
205
- )
206
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
207
- assert_select 'a', 0
208
- else
209
- assert_select 'a', false
210
- end
211
-
212
- get '/empty?p2=p2'
213
- assert_equal(
214
- [
215
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
216
- { base_url: 'http://www.example.com', path: '/empty', fullpath: '/empty?p2=p2' }
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
227
-
228
- get '/empty/nested?p3=p3'
229
- assert_equal(
230
- [
231
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
232
- { base_url: 'http://www.example.com', path: '/empty', fullpath: '/empty?p2=p2' },
233
- { base_url: 'http://www.example.com', path: '/empty/nested', fullpath: '/empty/nested?p3=p3' }
234
- ],
235
- session[:referers]
236
- )
237
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
238
- assert_select 'a', 1
239
- assert_select 'a[href="/?p1=p1"]:contains("Home")'
240
- else
241
- assert_select 'a', count: 1
242
- assert_select 'a[href="/?p1=p1"]', 'Home'
243
- end
244
-
245
- get '/'
246
- assert_equal(
247
- [
248
- { base_url: 'http://www.example.com', path: '/', fullpath: '/' }
249
- ],
250
- session[:referers]
251
- )
252
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
253
- assert_select 'a', 0
254
- else
255
- assert_select 'a', false
256
- end
257
- end
258
-
259
- test 'params not cause any error and can be use alter crumb name' do
260
- get '/?p1=p1'
261
- assert_equal(
262
- [
263
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
264
- ],
265
- session[:referers]
266
- )
267
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
268
- assert_select 'a', 0
269
- else
270
- assert_select 'a', false
271
- end
272
-
273
- get '/param?p2=p2'
274
- assert_equal(
275
- [
276
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
277
- { base_url: 'http://www.example.com', path: '/param', fullpath: '/param?p2=p2' }
278
- ],
279
- session[:referers]
280
- )
281
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
282
- assert_select 'a', 1
283
- assert_select 'a[href="/?p1=p1"]:contains("Home")'
284
- else
285
- assert_select 'a', count: 1
286
- assert_select 'a[href="/?p1=p1"]', 'Home'
287
- end
288
-
289
- get '/param/1?p3=p3'
290
- assert_equal(
291
- [
292
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
293
- { base_url: 'http://www.example.com', path: '/param', fullpath: '/param?p2=p2' },
294
- { base_url: 'http://www.example.com', path: '/param/1', fullpath: '/param/1?p3=p3' }
295
- ],
296
- session[:referers]
297
- )
298
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
299
- assert_select 'a', 2
300
- assert_select 'a[href="/?p1=p1"]:contains("Home")'
301
- assert_select 'a[href="/param?p2=p2"]:contains("Param")'
302
- else
303
- assert_select 'a', count: 2
304
- assert_select 'a[href="/?p1=p1"]', 'Home'
305
- assert_select 'a[href="/param?p2=p2"]', 'Param'
306
- end
307
-
308
- get '/param/1/nested?p4=p4'
309
- assert_equal(
310
- [
311
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
312
- { base_url: 'http://www.example.com', path: '/param', fullpath: '/param?p2=p2' },
313
- { base_url: 'http://www.example.com', path: '/param/1', fullpath: '/param/1?p3=p3' },
314
- { base_url: 'http://www.example.com', path: '/param/1/nested', fullpath: '/param/1/nested?p4=p4' }
315
- ],
316
- session[:referers]
317
- )
318
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
319
- assert_select 'a', 3
320
- assert_select 'a[href="/?p1=p1"]:contains("Home")'
321
- assert_select 'a[href="/param?p2=p2"]:contains("Param")'
322
- assert_select 'a[href="/param/1?p3=p3"]:contains("Param1")'
323
- else
324
- assert_select 'a', count: 3
325
- assert_select 'a[href="/?p1=p1"]', 'Home'
326
- assert_select 'a[href="/param?p2=p2"]', 'Param'
327
- assert_select 'a[href="/param/1?p3=p3"]', 'Param1'
328
- end
329
-
330
- get '/'
331
- assert_equal(
332
- [
333
- { base_url: 'http://www.example.com', path: '/', fullpath: '/' }
334
- ],
335
- session[:referers]
336
- )
337
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
338
- assert_select 'a', 0
339
- else
340
- assert_select 'a', false
341
- end
342
- end
343
-
344
- test 'going back not cause any error and retain history' do
345
- get '/?p1=p1'
346
- assert_equal(
347
- [
348
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
349
- ],
350
- session[:referers]
351
- )
352
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
353
- assert_select 'a', 0
354
- else
355
- assert_select 'a', false
356
- end
357
-
358
- get '/param?p2=p2'
359
- assert_equal(
360
- [
361
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
362
- { base_url: 'http://www.example.com', path: '/param', fullpath: '/param?p2=p2' }
363
- ],
364
- session[:referers]
365
- )
366
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
367
- assert_select 'a', 1
368
- assert_select 'a[href="/?p1=p1"]:contains("Home")'
369
- else
370
- assert_select 'a', count: 1
371
- assert_select 'a[href="/?p1=p1"]', 'Home'
372
- end
373
-
374
- get '/param/1?p3=p3'
375
- assert_equal(
376
- [
377
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
378
- { base_url: 'http://www.example.com', path: '/param', fullpath: '/param?p2=p2' },
379
- { base_url: 'http://www.example.com', path: '/param/1', fullpath: '/param/1?p3=p3' }
380
- ],
381
- session[:referers]
382
- )
383
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
384
- assert_select 'a', 2
385
- assert_select 'a[href="/?p1=p1"]:contains("Home")'
386
- assert_select 'a[href="/param?p2=p2"]:contains("Param")'
387
- else
388
- assert_select 'a', count: 2
389
- assert_select 'a[href="/?p1=p1"]', 'Home'
390
- assert_select 'a[href="/param?p2=p2"]', 'Param'
391
- end
392
-
393
- get '/param/1/nested?p4=p4'
394
- assert_equal(
395
- [
396
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
397
- { base_url: 'http://www.example.com', path: '/param', fullpath: '/param?p2=p2' },
398
- { base_url: 'http://www.example.com', path: '/param/1', fullpath: '/param/1?p3=p3' },
399
- { base_url: 'http://www.example.com', path: '/param/1/nested', fullpath: '/param/1/nested?p4=p4' }
400
- ],
401
- session[:referers]
402
- )
403
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
404
- assert_select 'a', 3
405
- assert_select 'a[href="/?p1=p1"]:contains("Home")'
406
- assert_select 'a[href="/param?p2=p2"]:contains("Param")'
407
- assert_select 'a[href="/param/1?p3=p3"]:contains("Param1")'
408
- else
409
- assert_select 'a', count: 3
410
- assert_select 'a[href="/?p1=p1"]', 'Home'
411
- assert_select 'a[href="/param?p2=p2"]', 'Param'
412
- assert_select 'a[href="/param/1?p3=p3"]', 'Param1'
413
- end
414
-
415
- get '/param'
416
- assert_equal(
417
- [
418
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
419
- { base_url: 'http://www.example.com', path: '/param', fullpath: '/param' }
420
- ],
421
- session[:referers]
422
- )
423
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
424
- assert_select 'a', 1
425
- assert_select 'a[href="/?p1=p1"]:contains("Home")'
426
- else
427
- assert_select 'a', count: 1
428
- assert_select 'a[href="/?p1=p1"]', 'Home'
429
- end
430
- end
431
-
432
- test 'translations not cause any error' do
433
- get '/?p1=p1'
434
- assert_equal(
435
- [
436
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
437
- ],
438
- session[:referers]
439
- )
440
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
441
- assert_select 'a', 0
442
- else
443
- assert_select 'a', false
444
- end
445
-
446
- get '/i18n?p2=p2'
447
- assert_equal(
448
- [
449
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
450
- { base_url: 'http://www.example.com', path: '/i18n', fullpath: '/i18n?p2=p2' }
451
- ],
452
- session[:referers]
453
- )
454
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
455
- assert_select 'a', 1
456
- assert_select 'a[href="/?p1=p1"]:contains("Home")'
457
- else
458
- assert_select 'a', count: 1
459
- assert_select 'a[href="/?p1=p1"]', 'Home'
460
- end
461
-
462
- get '/i18n/nested?p3=p3'
463
- assert_equal(
464
- [
465
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' },
466
- { base_url: 'http://www.example.com', path: '/i18n', fullpath: '/i18n?p2=p2' },
467
- { base_url: 'http://www.example.com', path: '/i18n/nested', fullpath: '/i18n/nested?p3=p3' }
468
- ],
469
- session[:referers]
470
- )
471
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
472
- assert_select 'a', 2
473
- assert_select 'a[href="/?p1=p1"]:contains("Home")'
474
- assert_select 'a[href="/i18n?p2=p2"]:contains("Hello world")'
475
- else
476
- assert_select 'a', count: 2
477
- assert_select 'a[href="/?p1=p1"]', 'Home'
478
- assert_select 'a[href="/i18n?p2=p2"]', 'Hello world'
479
- end
480
-
481
- get '/?p1=p1'
482
- assert_equal(
483
- [
484
- { base_url: 'http://www.example.com', path: '/', fullpath: '/?p1=p1' }
485
- ],
486
- session[:referers]
487
- )
488
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
489
- assert_select 'a', 0
490
- else
491
- assert_select 'a', false
492
- end
493
- end
494
-
495
- end