route_downcaser 0.2.2 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZmNmOWFjODRlN2U1ZDZjNzkwMzBmMGZiMDc5NTZhMWVmZjM2YTE4Zg==
4
+ YWRjOGIwNDZmMzcyODY2NDExNTUyYmRkYWZlNDEwNjI4ZDA1NWE2OA==
5
5
  data.tar.gz: !binary |-
6
- MmU0OTljZTQwZDE4ZjgxZjNkYmE5ZjI5ZWU3ZWM1YmYyZjc2NzY2MA==
6
+ YjkxZmI2MDk3MDEyODJiOTI1N2ViMjZlYTA3YWY5ZmMzYzUyZTRhYg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NjlhYWRiMWM5MzI2ZWJmYjdlZmYyZDZkMTgxMTc1NGNhMmRjNDI4ODA1MTJm
10
- YWU0MDJmZWRiNDY5MjZkN2MzM2Q1NDI3ODA2NWYyZDljYjJmM2E1MmRiMWZk
11
- M2ZkMDhkMGNmNTkyMzMxY2VhYmQ2ZWNlZjIwMDk0NzA0MTI5YWQ=
9
+ MTAzYzJmYTc5ZTBhOGZmNTFhYzNkYjBkOTI2NjdiMGRiYTc1MWNlY2E4ODhk
10
+ MWRiN2M5YmZhOGJiZmQ4ZWJkYmNjNzhkMTRlMGNiMDdjM2I5NzE2ZjUzOTA3
11
+ MTc3ZDVhZmY2NmIzZjkzMjM2YzZiOGVmOTAwOGUyZjcyMjJmMzA=
12
12
  data.tar.gz: !binary |-
13
- MDk0YTJmNTUwZGU4N2ZlZjc5NjVkMzZmMzNkODdlMGQyZmY1NjBhYzJiYTU2
14
- ZDRhMDIyMzkxYzNmOWFmNDE4MGI1OTI3ZWY0NWI4MDE1YmJhNWIwMzQzOTk2
15
- ODhmZTU3MDU3YjRiYjQxYzRjZWY4Nzk3YzA1OGZhNTU0OTQ1YWU=
13
+ NWZlZjJiMzM2MWEwNDA4ZDFjMWNlYTczODQxNTM1NmMxOGQxOGE4OGUyZmY3
14
+ MTEzMzMyY2I5YTBmODBiODU4MWRmOGUyMGQ5OGI5MzMzZTI1ODJkNGUzMGZi
15
+ NTNjMTA5MWMzYzMxZGI3NjZmMmQyYTI2MjIzNTNjNjlhMzg0MmM=
@@ -1,16 +1,16 @@
1
1
  = RouteDowncaser
2
2
 
3
- Makes routing in Rails case-insensitive (and other Rack-servers like Sinatra)
3
+ {<img src="https://travis-ci.org/carstengehling/route_downcaser.png" />}[https://travis-ci.org/carstengehling/route_downcaser] {<img src="https://codeclimate.com/github/carstengehling/route_downcaser/badges/gpa.svg" />}[https://codeclimate.com/github/carstengehling/route_downcaser]
4
4
 
5
- This gem hooks into the Rack middleware of Rails. This way all paths are downcased before dispatching to Rails' routing mechanism. Querystring parameters are not changed in any way.
5
+ Makes routing in Rails case-insensitive (and other Rack-servers like Sinatra)
6
6
 
7
- {<img src="https://travis-ci.org/carstengehling/route_downcaser.png" />}[https://travis-ci.org/carstengehling/route_downcaser]
7
+ This gem hooks into the Rack middleware of Rails. This way all paths are downcased before dispatching to Rails' routing mechanism. Querystring parameters and asset paths are not changed in any way.
8
8
 
9
9
  == Requirements
10
10
 
11
- This gem has been tested with Rails 3.+, Rails 4.0, and Sinatra
11
+ This gem has been tested with Rails 3.1.x, 4.0.x, 4.1.x, 4.2.x. It reportedly also works with Sinata, although I do not use Sinatra myself. Sinatra test-cases will be most welcome.
12
12
 
13
- If you want this functionality in a Rails 2.x application, please refer to {this blog post}[http://gehling.dk/2010/02/how-to-make-rails-routing-case-insensitive].
13
+ If you want this functionality in a Rails 2.x-3.0 application, please refer to {this blog post}[http://gehling.dk/2010/02/how-to-make-rails-routing-case-insensitive].
14
14
 
15
15
  == Installing
16
16
 
@@ -56,6 +56,30 @@ will respond to all these requests:
56
56
  http://localhost:4567/Foo
57
57
  http://localhost:4567/FOO
58
58
 
59
+ == Configuration Options
60
+
61
+ Configuration options can be set using an initializer in your application like so:
62
+
63
+ # config/initializers/route_downcaser.rb
64
+
65
+ RouteDowncaser.configuration do |config|
66
+ config.redirect = true
67
+
68
+ config.exclude_patterns = [
69
+ /assets\//i,
70
+ /fonts\//i,
71
+ /some\/important\/path/i
72
+ ]
73
+ end
74
+
75
+ === redirect
76
+
77
+ With this configuration option set to `true`, the middleware will 301 redirect all routes to their downcased version. Example: `http://localhost:3000/Foo` will redirect to `http://localhost:3000/foo`.
78
+
79
+ === exclude_patterns
80
+
81
+ Array of regular expressions. If the requested path matches one of these expressions, RouteDowncaser will not change anything.
82
+
59
83
  == Background information
60
84
 
61
85
  Sometimes you may wish to market a url which contains a controller name - like www.myshop.com/specialoffer. If this is done on offline media it will cause potential customers trouble, if they don't use the correct casing. If, for some reason, the user types www.myshop.com/Specialoffer (with capital S), your Rails app will return a 404 not found.
@@ -74,21 +98,13 @@ At first I just made this code as a snippet and published it {on my blog}[http:/
74
98
 
75
99
  All it really does is to take the path and downcase it before dispatching. Querystring parameters are NOT touched, they keep their casing, since it may have some contextual meaning.
76
100
 
77
- == Configuration Options
78
-
79
- Configuration options can be set using an initializer in your application like so:
80
-
81
- # config/initializers/route_downcaser.rb
82
-
83
- RouteDowncaser.configuration do |config|
84
- config.redirect = true
85
- end
101
+ == Changelog
86
102
 
87
- === Redirect
103
+ === 1.0.1
88
104
 
89
- With this configuration option set to `true`, the middleware will 301 redirect all routes to their downcased version. Example: `http://localhost:3000/Foo` will redirect to `http://localhost:3000/foo`.
105
+ Refactored parts of the code to work with Rails 4.2.0
90
106
 
91
- == Changelog
107
+ New config for ignoring/excluding paths
92
108
 
93
109
  === 0.2.2
94
110
 
@@ -6,4 +6,5 @@ module RouteDowncaser
6
6
  extend Configuration
7
7
 
8
8
  define_setting :redirect, false
9
+ define_setting :exclude_patterns, [/assets\//i]
9
10
  end
@@ -5,19 +5,18 @@ module RouteDowncaser
5
5
  end
6
6
 
7
7
  def call(env)
8
- @env = env
9
-
8
+ env = env.clone
10
9
  if env['REQUEST_URI']
11
- if RouteDowncaser.redirect == true
12
- if path != path.downcase
13
- return [301, {'Location' => downcased_uri, 'Content-Type' => 'text/html'}, []]
10
+ if RouteDowncaser.redirect == true && !exclude_patterns_match?(env['REQUEST_URI'])
11
+ if path(env) != path(env).downcase
12
+ return [301, {'Location' => downcased_uri(env), 'Content-Type' => 'text/html'}, []]
14
13
  end
15
14
  else
16
- env['REQUEST_URI'] = downcased_uri
15
+ env['REQUEST_URI'] = downcased_uri(env)
17
16
  end
18
17
  end
19
18
 
20
- if env['PATH_INFO'] =~ /assets\//i
19
+ if exclude_patterns_match?(env['PATH_INFO'])
21
20
  pieces = env['PATH_INFO'].split('/')
22
21
  env['PATH_INFO'] = pieces.slice(0..-2).join('/').downcase + '/' + pieces.last
23
22
  elsif env['PATH_INFO']
@@ -29,24 +28,28 @@ module RouteDowncaser
29
28
 
30
29
  private
31
30
 
32
- def uri_items
33
- @env['REQUEST_URI'].split('?')
31
+ def uri_items(env)
32
+ env['REQUEST_URI'].split('?')
34
33
  end
35
34
 
36
- def path
37
- uri_items[0]
35
+ def path(env)
36
+ uri_items(env).first
38
37
  end
39
38
 
40
- def query?
41
- uri_items.length > 1
39
+ def querystring?(env)
40
+ uri_items(env).length > 1
42
41
  end
43
42
 
44
- def downcased_uri
45
- if query?
46
- "#{path.downcase!}?#{uri_items[1]}"
43
+ def downcased_uri(env)
44
+ if querystring?(env)
45
+ "#{path(env).downcase!}?#{uri_items(env)[1]}"
47
46
  else
48
- path.downcase!
47
+ path(env).downcase!
49
48
  end
50
49
  end
50
+
51
+ def exclude_patterns_match?(uri)
52
+ uri.match(Regexp.union(RouteDowncaser.exclude_patterns)) if uri
53
+ end
51
54
  end
52
55
  end
@@ -1,3 +1,3 @@
1
1
  module RouteDowncaser
2
- VERSION = "0.2.2"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -8,7 +8,11 @@ Dummy::Application.configure do
8
8
  config.cache_classes = true
9
9
 
10
10
  # Configure static asset server for tests with Cache-Control for performance
11
- config.serve_static_assets = true
11
+ if Rails::VERSION::MAJOR >= 4
12
+ config.serve_static_files = true
13
+ else
14
+ config.serve_static_assets = true
15
+ end
12
16
  config.static_cache_control = "public, max-age=3600"
13
17
 
14
18
  # Show full error reports and disable caching
@@ -33,4 +37,6 @@ Dummy::Application.configure do
33
37
  config.active_support.deprecation = :stderr
34
38
 
35
39
  config.eager_load = false
40
+
41
+ config.active_support.test_order = :sorted
36
42
  end
@@ -245,3 +245,589 @@ Started GET "/HELLO/WORLD" for 127.0.0.1 at 2014-12-19 18:56:30 +0100
245
245
  Processing by HelloController#world as HTML
246
246
  Rendered text template (0.0ms)
247
247
  Completed 200 OK in 6.2ms (Views: 5.9ms)
248
+
249
+
250
+ Started GET "/HELLO/WORLD" for 127.0.0.1 at 2015-03-10 09:54:50 +0100
251
+ Processing by HelloController#world as HTML
252
+ Rendered text template (0.0ms)
253
+ Completed 200 OK in 21ms (Views: 20.4ms)
254
+ ----------------------------------------------------------------------------------------------------------------
255
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
256
+ ----------------------------------------------------------------------------------------------------------------
257
+ ----------------------------------------------------------------------------------------------------------------------------------
258
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
259
+ ----------------------------------------------------------------------------------------------------------------------------------
260
+ -----------------------------------------------------------
261
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
262
+ -----------------------------------------------------------
263
+ ---------------------------------------------------------------------------
264
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
265
+ ---------------------------------------------------------------------------
266
+ --------------------------------------------------------
267
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
268
+ --------------------------------------------------------
269
+ ------------------------------------------------------
270
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
271
+ ------------------------------------------------------
272
+ -------------------------------------------------------------
273
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
274
+ -------------------------------------------------------------
275
+ ----------------------------------------------------------------------------------------------------------------
276
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
277
+ ----------------------------------------------------------------------------------------------------------------
278
+ ----------------------------------------------------------------------------------------------------------------------------------
279
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
280
+ ----------------------------------------------------------------------------------------------------------------------------------
281
+ -----------------------------------------------------------
282
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
283
+ -----------------------------------------------------------
284
+ ---------------------------------------------------------------------------
285
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
286
+ ---------------------------------------------------------------------------
287
+ --------------------------------------------------------
288
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
289
+ --------------------------------------------------------
290
+ ------------------------------------------------------
291
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
292
+ ------------------------------------------------------
293
+ -------------------------------------------------------------
294
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
295
+ -------------------------------------------------------------
296
+ ----------------------------------------------------------------------------------------------------------------
297
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
298
+ ----------------------------------------------------------------------------------------------------------------
299
+ ----------------------------------------------------------------------------------------------------------------------------------
300
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
301
+ ----------------------------------------------------------------------------------------------------------------------------------
302
+ -----------------------------------------------------------
303
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
304
+ -----------------------------------------------------------
305
+ ---------------------------------------------------------------------------
306
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
307
+ ---------------------------------------------------------------------------
308
+ --------------------------------------------------------
309
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
310
+ --------------------------------------------------------
311
+ ------------------------------------------------------
312
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
313
+ ------------------------------------------------------
314
+ -------------------------------------------------------------
315
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
316
+ -------------------------------------------------------------
317
+ -----------------------------------------------------------
318
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
319
+ -----------------------------------------------------------
320
+ ---------------------------------------------------------------------------
321
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
322
+ ---------------------------------------------------------------------------
323
+ --------------------------------------------------------
324
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
325
+ --------------------------------------------------------
326
+ ------------------------------------------------------
327
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
328
+ ------------------------------------------------------
329
+ -------------------------------------------------------------
330
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
331
+ -------------------------------------------------------------
332
+ ----------------------------------------------------------------------------------------------------------------
333
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
334
+ ----------------------------------------------------------------------------------------------------------------
335
+ ----------------------------------------------------------------------------------------------------------------------------------
336
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
337
+ ----------------------------------------------------------------------------------------------------------------------------------
338
+ -----------------------------------------------------------
339
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
340
+ -----------------------------------------------------------
341
+ ---------------------------------------------------------------------------
342
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
343
+ ---------------------------------------------------------------------------
344
+ --------------------------------------------------------
345
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
346
+ --------------------------------------------------------
347
+ ------------------------------------------------------
348
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
349
+ ------------------------------------------------------
350
+ -------------------------------------------------------------
351
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
352
+ -------------------------------------------------------------
353
+ ----------------------------------------------------------------------------------------------------------------
354
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
355
+ ----------------------------------------------------------------------------------------------------------------
356
+ ----------------------------------------------------------------------------------------------------------------------------------
357
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
358
+ ----------------------------------------------------------------------------------------------------------------------------------
359
+ ----------------------------------------------------------------------------------------------------------------
360
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
361
+ ----------------------------------------------------------------------------------------------------------------
362
+ ----------------------------------------------------------------------------------------------------------------------------------
363
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
364
+ ----------------------------------------------------------------------------------------------------------------------------------
365
+ -------------------------------------------------------------
366
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
367
+ -------------------------------------------------------------
368
+ -----------------------------------------------------------
369
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
370
+ -----------------------------------------------------------
371
+ ---------------------------------------------------------------------------
372
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
373
+ ---------------------------------------------------------------------------
374
+ --------------------------------------------------------
375
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
376
+ --------------------------------------------------------
377
+ ------------------------------------------------------
378
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
379
+ ------------------------------------------------------
380
+ ----------------------------------------------------------------------------------------------------------------
381
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
382
+ ----------------------------------------------------------------------------------------------------------------
383
+ ----------------------------------------------------------------------------------------------------------------------------------
384
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
385
+ ----------------------------------------------------------------------------------------------------------------------------------
386
+ -----------------------------------------------------------
387
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
388
+ -----------------------------------------------------------
389
+ ---------------------------------------------------------------------------
390
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
391
+ ---------------------------------------------------------------------------
392
+ --------------------------------------------------------
393
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
394
+ --------------------------------------------------------
395
+ ------------------------------------------------------
396
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
397
+ ------------------------------------------------------
398
+ -------------------------------------------------------------
399
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
400
+ -------------------------------------------------------------
401
+ -------------------------------------------------------------
402
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
403
+ -------------------------------------------------------------
404
+ -----------------------------------------------------------
405
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
406
+ -----------------------------------------------------------
407
+ ---------------------------------------------------------------------------
408
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
409
+ ---------------------------------------------------------------------------
410
+ --------------------------------------------------------
411
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
412
+ --------------------------------------------------------
413
+ ------------------------------------------------------
414
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
415
+ ------------------------------------------------------
416
+ ----------------------------------------------------------------------------------------------------------------
417
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
418
+ ----------------------------------------------------------------------------------------------------------------
419
+ ----------------------------------------------------------------------------------------------------------------------------------
420
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
421
+ ----------------------------------------------------------------------------------------------------------------------------------
422
+ -------------------------------------------------------------
423
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
424
+ -------------------------------------------------------------
425
+ -----------------------------------------------------------
426
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
427
+ -----------------------------------------------------------
428
+ ---------------------------------------------------------------------------
429
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
430
+ ---------------------------------------------------------------------------
431
+ --------------------------------------------------------
432
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
433
+ --------------------------------------------------------
434
+ ------------------------------------------------------
435
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
436
+ ------------------------------------------------------
437
+ ----------------------------------------------------------------------------------------------------------------
438
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
439
+ ----------------------------------------------------------------------------------------------------------------
440
+ ----------------------------------------------------------------------------------------------------------------------------------
441
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
442
+ ----------------------------------------------------------------------------------------------------------------------------------
443
+ -------------------------------------------------------------
444
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
445
+ -------------------------------------------------------------
446
+ -----------------------------------------------------------
447
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
448
+ -----------------------------------------------------------
449
+ ---------------------------------------------------------------------------
450
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
451
+ ---------------------------------------------------------------------------
452
+ --------------------------------------------------------
453
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
454
+ --------------------------------------------------------
455
+ ------------------------------------------------------
456
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
457
+ ------------------------------------------------------
458
+ ----------------------------------------------------------------------------------------------------------------
459
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
460
+ ----------------------------------------------------------------------------------------------------------------
461
+ ----------------------------------------------------------------------------------------------------------------------------------
462
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
463
+ ----------------------------------------------------------------------------------------------------------------------------------
464
+ -----------------------------------------------------------
465
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
466
+ -----------------------------------------------------------
467
+ ---------------------------------------------------------------------------
468
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
469
+ ---------------------------------------------------------------------------
470
+ --------------------------------------------------------
471
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
472
+ --------------------------------------------------------
473
+ ------------------------------------------------------
474
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
475
+ ------------------------------------------------------
476
+ -------------------------------------------------------------
477
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
478
+ -------------------------------------------------------------
479
+ ----------------------------------------------------------------------------------------------------------------
480
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
481
+ ----------------------------------------------------------------------------------------------------------------
482
+ ----------------------------------------------------------------------------------------------------------------------------------
483
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
484
+ ----------------------------------------------------------------------------------------------------------------------------------
485
+ -------------------------------------------------------------
486
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
487
+ -------------------------------------------------------------
488
+ ----------------------------------------------------------------------------------------------------------------
489
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
490
+ ----------------------------------------------------------------------------------------------------------------
491
+ ----------------------------------------------------------------------------------------------------------------------------------
492
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
493
+ ----------------------------------------------------------------------------------------------------------------------------------
494
+ -----------------------------------------------------------
495
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
496
+ -----------------------------------------------------------
497
+ ---------------------------------------------------------------------------
498
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
499
+ ---------------------------------------------------------------------------
500
+ --------------------------------------------------------
501
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
502
+ --------------------------------------------------------
503
+ ------------------------------------------------------
504
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
505
+ ------------------------------------------------------
506
+ -------------------------------------------------------------
507
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
508
+ -------------------------------------------------------------
509
+ ----------------------------------------------------------------------------------------------------------------
510
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
511
+ ----------------------------------------------------------------------------------------------------------------
512
+ ----------------------------------------------------------------------------------------------------------------------------------
513
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
514
+ ----------------------------------------------------------------------------------------------------------------------------------
515
+ -----------------------------------------------------------
516
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
517
+ -----------------------------------------------------------
518
+ ---------------------------------------------------------------------------
519
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
520
+ ---------------------------------------------------------------------------
521
+ --------------------------------------------------------
522
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
523
+ --------------------------------------------------------
524
+ ------------------------------------------------------
525
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
526
+ ------------------------------------------------------
527
+ -----------------------------------------------------------
528
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
529
+ -----------------------------------------------------------
530
+ ---------------------------------------------------------------------------
531
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
532
+ ---------------------------------------------------------------------------
533
+ --------------------------------------------------------
534
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
535
+ --------------------------------------------------------
536
+ ------------------------------------------------------
537
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
538
+ ------------------------------------------------------
539
+ ----------------------------------------------------------------------------------------------------------------
540
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
541
+ ----------------------------------------------------------------------------------------------------------------
542
+ ----------------------------------------------------------------------------------------------------------------------------------
543
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
544
+ ----------------------------------------------------------------------------------------------------------------------------------
545
+ -------------------------------------------------------------
546
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
547
+ -------------------------------------------------------------
548
+ -------------------------------------------------------------
549
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
550
+ -------------------------------------------------------------
551
+ ----------------------------------------------------------------------------------------------------------------
552
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
553
+ ----------------------------------------------------------------------------------------------------------------
554
+ ----------------------------------------------------------------------------------------------------------------------------------
555
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
556
+ ----------------------------------------------------------------------------------------------------------------------------------
557
+ -----------------------------------------------------------
558
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
559
+ -----------------------------------------------------------
560
+ ---------------------------------------------------------------------------
561
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
562
+ ---------------------------------------------------------------------------
563
+ --------------------------------------------------------
564
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
565
+ --------------------------------------------------------
566
+ ------------------------------------------------------
567
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
568
+ ------------------------------------------------------
569
+ ----------------------------------------------------------------------------------------------------------------
570
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
571
+ ----------------------------------------------------------------------------------------------------------------
572
+ ----------------------------------------------------------------------------------------------------------------------------------
573
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
574
+ ----------------------------------------------------------------------------------------------------------------------------------
575
+ -----------------------------------------------------------
576
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
577
+ -----------------------------------------------------------
578
+ ---------------------------------------------------------------------------
579
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
580
+ ---------------------------------------------------------------------------
581
+ --------------------------------------------------------
582
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
583
+ --------------------------------------------------------
584
+ ------------------------------------------------------
585
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
586
+ ------------------------------------------------------
587
+ -------------------------------------------------------------
588
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
589
+ -------------------------------------------------------------
590
+ -------------------------------------------------------------
591
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
592
+ -------------------------------------------------------------
593
+ -----------------------------------------------------------
594
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
595
+ -----------------------------------------------------------
596
+ ---------------------------------------------------------------------------
597
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
598
+ ---------------------------------------------------------------------------
599
+ --------------------------------------------------------
600
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
601
+ --------------------------------------------------------
602
+ ------------------------------------------------------
603
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
604
+ ------------------------------------------------------
605
+ ----------------------------------------------------------------------------------------------------------------
606
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
607
+ ----------------------------------------------------------------------------------------------------------------
608
+ ----------------------------------------------------------------------------------------------------------------------------------
609
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
610
+ ----------------------------------------------------------------------------------------------------------------------------------
611
+ -----------------------------------------------------------
612
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
613
+ -----------------------------------------------------------
614
+ ---------------------------------------------------------------------------
615
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
616
+ ---------------------------------------------------------------------------
617
+ --------------------------------------------------------
618
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
619
+ --------------------------------------------------------
620
+ ------------------------------------------------------
621
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
622
+ ------------------------------------------------------
623
+ ----------------------------------------------------------------------------------------------------------------
624
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
625
+ ----------------------------------------------------------------------------------------------------------------
626
+ ----------------------------------------------------------------------------------------------------------------------------------
627
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
628
+ ----------------------------------------------------------------------------------------------------------------------------------
629
+ -------------------------------------------------------------
630
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
631
+ -------------------------------------------------------------
632
+ -------------------------------------------------------------
633
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
634
+ -------------------------------------------------------------
635
+ ----------------------------------------------------------------------------------------------------------------
636
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
637
+ ----------------------------------------------------------------------------------------------------------------
638
+ ----------------------------------------------------------------------------------------------------------------------------------
639
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
640
+ ----------------------------------------------------------------------------------------------------------------------------------
641
+ -----------------------------------------------------------
642
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
643
+ -----------------------------------------------------------
644
+ ---------------------------------------------------------------------------
645
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
646
+ ---------------------------------------------------------------------------
647
+ --------------------------------------------------------
648
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
649
+ --------------------------------------------------------
650
+ ------------------------------------------------------
651
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
652
+ ------------------------------------------------------
653
+ ----------------------------------------------------------------------------------------------------------------
654
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
655
+ ----------------------------------------------------------------------------------------------------------------
656
+ ----------------------------------------------------------------------------------------------------------------------------------
657
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
658
+ ----------------------------------------------------------------------------------------------------------------------------------
659
+ -------------------------------------------------------------
660
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
661
+ -------------------------------------------------------------
662
+ -----------------------------------------------------------
663
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
664
+ -----------------------------------------------------------
665
+ ---------------------------------------------------------------------------
666
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
667
+ ---------------------------------------------------------------------------
668
+ --------------------------------------------------------
669
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
670
+ --------------------------------------------------------
671
+ ------------------------------------------------------
672
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
673
+ ------------------------------------------------------
674
+ -----------------------------------------------------------
675
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
676
+ -----------------------------------------------------------
677
+ ---------------------------------------------------------------------------
678
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
679
+ ---------------------------------------------------------------------------
680
+ --------------------------------------------------------
681
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
682
+ --------------------------------------------------------
683
+ ------------------------------------------------------
684
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
685
+ ------------------------------------------------------
686
+ ----------------------------------------------------------------------------------------------------------------
687
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
688
+ ----------------------------------------------------------------------------------------------------------------
689
+ ----------------------------------------------------------------------------------------------------------------------------------
690
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
691
+ ----------------------------------------------------------------------------------------------------------------------------------
692
+ -------------------------------------------------------------
693
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
694
+ -------------------------------------------------------------
695
+ Started GET "/HELLO/WORLD" for 127.0.0.1 at 2015-03-10 12:46:48 +0100
696
+ Processing by HelloController#world as HTML
697
+ Rendered text template (0.0ms)
698
+ Completed 200 OK in 7ms (Views: 6.6ms)
699
+ -----------------------------------------------------------
700
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
701
+ -----------------------------------------------------------
702
+ ---------------------------------------------------------------------------
703
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
704
+ ---------------------------------------------------------------------------
705
+ --------------------------------------------------------
706
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
707
+ --------------------------------------------------------
708
+ ------------------------------------------------------
709
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
710
+ ------------------------------------------------------
711
+ ----------------------------------------------------------------------------------------------------------------
712
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
713
+ ----------------------------------------------------------------------------------------------------------------
714
+ ----------------------------------------------------------------------------------------------------------------------------------
715
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
716
+ ----------------------------------------------------------------------------------------------------------------------------------
717
+ -------------------------------------------------------------
718
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
719
+ -------------------------------------------------------------
720
+ Started GET "/HELLO/WORLD" for 127.0.0.1 at 2015-03-10 12:47:36 +0100
721
+ Processing by HelloController#world as HTML
722
+ Rendered text template (0.0ms)
723
+ Completed 200 OK in 7ms (Views: 6.9ms)
724
+ -------------------------------------------------------------
725
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
726
+ -------------------------------------------------------------
727
+ Started GET "/HELLO/WORLD" for 127.0.0.1 at 2015-03-10 12:48:50 +0100
728
+ Processing by HelloController#world as HTML
729
+ Rendered text template (0.0ms)
730
+ Completed 200 OK in 21ms (Views: 21.1ms)
731
+ -----------------------------------------------------------
732
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
733
+ -----------------------------------------------------------
734
+ ---------------------------------------------------------------------------
735
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
736
+ ---------------------------------------------------------------------------
737
+ --------------------------------------------------------
738
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
739
+ --------------------------------------------------------
740
+ ------------------------------------------------------
741
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
742
+ ------------------------------------------------------
743
+ ----------------------------------------------------------------------------------------------------------------
744
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
745
+ ----------------------------------------------------------------------------------------------------------------
746
+ ----------------------------------------------------------------------------------------------------------------------------------
747
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
748
+ ----------------------------------------------------------------------------------------------------------------------------------
749
+ -----------------------------------------------------------
750
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
751
+ -----------------------------------------------------------
752
+ ---------------------------------------------------------------------------
753
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
754
+ ---------------------------------------------------------------------------
755
+ --------------------------------------------------------
756
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
757
+ --------------------------------------------------------
758
+ ------------------------------------------------------
759
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
760
+ ------------------------------------------------------
761
+ ----------------------------------------------------------------------------------------------------------------
762
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
763
+ ----------------------------------------------------------------------------------------------------------------
764
+ ----------------------------------------------------------------------------------------------------------------------------------
765
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
766
+ ----------------------------------------------------------------------------------------------------------------------------------
767
+ -------------------------------------------------------------
768
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
769
+ -------------------------------------------------------------
770
+ Started GET "/HELLO/WORLD" for 127.0.0.1 at 2015-03-10 12:49:21 +0100
771
+ Processing by HelloController#world as HTML
772
+ Rendered text template (0.0ms)
773
+ Completed 200 OK in 5ms (Views: 5.1ms)
774
+ Started GET "/HELLO/WORLD" for 127.0.0.1 at 2015-03-10 12:49:50 +0100
775
+ Processing by HelloController#world as HTML
776
+ Rendered text template (0.0ms)
777
+ Completed 200 OK in 21.9ms (Views: 21.7ms)
778
+
779
+
780
+ Started GET "/HELLO/WORLD" for 127.0.0.1 at 2015-03-10 12:50:06 +0100
781
+ Processing by HelloController#world as HTML
782
+ Rendered text template (0.0ms)
783
+ Completed 200 OK in 21ms (Views: 20.6ms)
784
+ -----------------------------------------------------------
785
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
786
+ -----------------------------------------------------------
787
+ ---------------------------------------------------------------------------
788
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
789
+ ---------------------------------------------------------------------------
790
+ --------------------------------------------------------
791
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
792
+ --------------------------------------------------------
793
+ ------------------------------------------------------
794
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
795
+ ------------------------------------------------------
796
+ -------------------------------------------------------------
797
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
798
+ -------------------------------------------------------------
799
+ Started GET "/HELLO/WORLD" for 127.0.0.1 at 2015-03-10 13:21:12 +0100
800
+ Processing by HelloController#world as HTML
801
+ Rendered text template (0.0ms)
802
+ Completed 200 OK in 23ms (Views: 22.7ms)
803
+ ----------------------------------------------------------------------------------------------------------------
804
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
805
+ ----------------------------------------------------------------------------------------------------------------
806
+ ----------------------------------------------------------------------------------------------------------------------------------
807
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
808
+ ----------------------------------------------------------------------------------------------------------------------------------
809
+ -------------------------------------------------------------
810
+ RouteMiddlewareTest: test_Middleware_is_installed_and_working
811
+ -------------------------------------------------------------
812
+ Started GET "/HELLO/WORLD" for 127.0.0.1 at 2015-03-10 13:39:52 +0100
813
+ Processing by HelloController#world as HTML
814
+ Rendered text template (0.0ms)
815
+ Completed 200 OK in 23ms (Views: 22.5ms)
816
+ -----------------------------------------------------------
817
+ RouteDowncaserTest: test_REQUEST_URI_path-part_is_downcased
818
+ -----------------------------------------------------------
819
+ ---------------------------------------------------------------------------
820
+ RouteDowncaserTest: test_REQUEST_URI_querystring_parameters_are_not_touched
821
+ ---------------------------------------------------------------------------
822
+ --------------------------------------------------------
823
+ RouteDowncaserTest: test_asset_filenames_are_not_touched
824
+ --------------------------------------------------------
825
+ ------------------------------------------------------
826
+ RouteDowncaserTest: test_entire_PATH_INFO_is_downcased
827
+ ------------------------------------------------------
828
+ ----------------------------------------------------------------------------------------------------------------
829
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_does_not_redirect_matching_exclude_patterns
830
+ ----------------------------------------------------------------------------------------------------------------
831
+ ----------------------------------------------------------------------------------------------------------------------------------
832
+ RouteDowncaserTest::RedirectTrueTests: test_when_redirect_is_true_it_redirects_paths_that_do_not_contain_matching_exclude_patterns
833
+ ----------------------------------------------------------------------------------------------------------------------------------
@@ -6,7 +6,7 @@ class RouteMiddlewareTest < ActionDispatch::IntegrationTest
6
6
  config.redirect = false
7
7
  end
8
8
 
9
- get "HELLO/WORLD"
9
+ get "/HELLO/WORLD"
10
10
  assert_response :success
11
11
  assert_equal("anybody out there?", @response.body)
12
12
  end
@@ -41,16 +41,30 @@ class RouteDowncaserTest < ActiveSupport::TestCase
41
41
  assert_equal("assets/images/SpaceCat.jpeg", app.env['PATH_INFO'])
42
42
  end
43
43
 
44
- test "when redirect is set to true it redirects" do
45
- app = MockApp.new
46
- env = { 'REQUEST_URI' => "HELLO/WORLD" }
47
- RouteDowncaser.configuration do |config|
48
- config.redirect = true
44
+ class RedirectTrueTests < ActiveSupport::TestCase
45
+ setup do
46
+ @app = MockApp.new
47
+ RouteDowncaser.configuration do |config|
48
+ config.redirect = true
49
+ config.exclude_patterns = [/assets\//i, /fonts\//i]
50
+ end
51
+ end
52
+
53
+ test "when redirect is true it redirects paths that do not contain matching exclude patterns" do
54
+ env = { 'REQUEST_URI' => "HELLO/WORLD" }
55
+
56
+ assert_equal(
57
+ RouteDowncaser::DowncaseRouteMiddleware.new(@app).call(env),
58
+ [301, {'Location' => "hello/world", 'Content-Type' => 'text/html'}, []]
59
+ )
49
60
  end
50
61
 
51
- assert_equal(
52
- RouteDowncaser::DowncaseRouteMiddleware.new(app).call(env),
53
- [301, {'Location' => "hello/world", 'Content-Type' => 'text/html'}, []]
54
- )
62
+ test "when redirect is true it does not redirect matching exclude patterns" do
63
+ env = { 'REQUEST_URI' => "fonts/Icons.woff", 'PATH_INFO' => "fonts/Icons.woff" }
64
+
65
+ RouteDowncaser::DowncaseRouteMiddleware.new(@app).call(env)
66
+
67
+ assert_equal("fonts/Icons.woff", @app.env['PATH_INFO'])
68
+ end
55
69
  end
56
70
  end
@@ -1,3 +1,6 @@
1
+ require "codeclimate-test-reporter"
2
+ CodeClimate::TestReporter.start
3
+
1
4
  # Configure Rails Environment
2
5
  ENV["RAILS_ENV"] = "test"
3
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: route_downcaser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Gehling
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-19 00:00:00.000000000 Z
11
+ date: 2015-03-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This gem hooks into the Rack middleware of Rails. This way all paths
14
14
  are downcased before dispatching to Rails' routing mechanism. Querystring parameters
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  version: '0'
81
81
  requirements: []
82
82
  rubyforge_project:
83
- rubygems_version: 2.2.2
83
+ rubygems_version: 2.4.5
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: Makes routing in Rails case-insensitive