rails_i18n_routes 1.1.9 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. metadata +18 -139
  3. data/MIT-LICENSE +0 -20
  4. data/README.rdoc +0 -50
  5. data/Rakefile +0 -38
  6. data/lib/rails_i18n_routes.rb +0 -8
  7. data/lib/rails_i18n_routes/action_controller/base.rb +0 -37
  8. data/lib/rails_i18n_routes/action_dispatch/mapper.rb +0 -71
  9. data/lib/rails_i18n_routes/action_dispatch/route_set/named_route_collection.rb +0 -28
  10. data/lib/rails_i18n_routes/railtie.rb +0 -14
  11. data/lib/rails_i18n_routes/version.rb +0 -5
  12. data/test/dummy/README.rdoc +0 -261
  13. data/test/dummy/Rakefile +0 -7
  14. data/test/dummy/app/assets/javascripts/application.js +0 -15
  15. data/test/dummy/app/assets/stylesheets/application.css +0 -13
  16. data/test/dummy/app/controllers/application_controller.rb +0 -4
  17. data/test/dummy/app/controllers/namespace/nested_controller.rb +0 -7
  18. data/test/dummy/app/controllers/namespace/nesteds_resources_controller.rb +0 -7
  19. data/test/dummy/app/controllers/params_controller.rb +0 -7
  20. data/test/dummy/app/controllers/resources_controller.rb +0 -7
  21. data/test/dummy/app/controllers/simples_controller.rb +0 -7
  22. data/test/dummy/app/helpers/application_helper.rb +0 -2
  23. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  24. data/test/dummy/app/views/namespace/nesteds/show.html.erb +0 -0
  25. data/test/dummy/app/views/params/show.html.erb +0 -0
  26. data/test/dummy/app/views/simples/show.html.erb +0 -0
  27. data/test/dummy/config.ru +0 -4
  28. data/test/dummy/config/application.rb +0 -66
  29. data/test/dummy/config/boot.rb +0 -10
  30. data/test/dummy/config/database.yml +0 -25
  31. data/test/dummy/config/environment.rb +0 -5
  32. data/test/dummy/config/environments/development.rb +0 -37
  33. data/test/dummy/config/environments/production.rb +0 -67
  34. data/test/dummy/config/environments/test.rb +0 -37
  35. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  36. data/test/dummy/config/initializers/inflections.rb +0 -15
  37. data/test/dummy/config/initializers/mime_types.rb +0 -5
  38. data/test/dummy/config/initializers/secret_token.rb +0 -7
  39. data/test/dummy/config/initializers/session_store.rb +0 -8
  40. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  41. data/test/dummy/config/locales/en-US.yml +0 -9
  42. data/test/dummy/config/locales/es-AR.yml +0 -9
  43. data/test/dummy/config/locales/es-UY.yml +0 -9
  44. data/test/dummy/config/routes.rb +0 -69
  45. data/test/dummy/db/development.sqlite3 +0 -0
  46. data/test/dummy/db/schema.rb +0 -16
  47. data/test/dummy/log/development.log +0 -99
  48. data/test/dummy/log/test.log +0 -4558
  49. data/test/dummy/public/404.html +0 -26
  50. data/test/dummy/public/422.html +0 -26
  51. data/test/dummy/public/500.html +0 -25
  52. data/test/dummy/public/favicon.ico +0 -0
  53. data/test/dummy/script/rails +0 -6
  54. data/test/rails_i18n_routes_test.rb +0 -9
  55. data/test/routes_test.rb +0 -96
  56. data/test/selection_test.rb +0 -34
  57. data/test/test_helper.rb +0 -15
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/404.html -->
21
- <div class="dialog">
22
- <h1>The page you were looking for doesn't exist.</h1>
23
- <p>You may have mistyped the address or the page may have moved.</p>
24
- </div>
25
- </body>
26
- </html>
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The change you wanted was rejected (422)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/422.html -->
21
- <div class="dialog">
22
- <h1>The change you wanted was rejected.</h1>
23
- <p>Maybe you tried to change something you didn't have access to.</p>
24
- </div>
25
- </body>
26
- </html>
@@ -1,25 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/500.html -->
21
- <div class="dialog">
22
- <h1>We're sorry, but something went wrong.</h1>
23
- </div>
24
- </body>
25
- </html>
File without changes
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
- APP_PATH = File.expand_path('../../config/application', __FILE__)
5
- require File.expand_path('../../config/boot', __FILE__)
6
- require 'rails/commands'
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
-
3
- class RailsI18nRoutesTest < ActiveSupport::TestCase
4
-
5
- test "truth" do
6
- assert_kind_of Module, RailsI18nRoutes
7
- end
8
-
9
- end
data/test/routes_test.rb DELETED
@@ -1,96 +0,0 @@
1
- require 'test_helper'
2
-
3
- class RoutesTest < ActionController::IntegrationTest
4
-
5
- test "should translate subdomain routes" do
6
- with_routes_type :subdomain do
7
- Rails.application.config.i18n_routes.mapping.each_pair do |lang, countries|
8
- countries = [countries] unless countries.is_a? Array
9
- countries.each do |country|
10
- I18n.locale = "#{lang}-#{country.upcase}"
11
-
12
- assert_recognizes(
13
- { :controller => 'namespace/nesteds_resources', :action => 'show' },
14
- "http://#{country}.example.org/#{I18n.t('routes.namespace')}/#{I18n.t('routes.nesteds_resources')}"
15
- )
16
-
17
- assert_recognizes(
18
- { :controller => 'namespace/nesteds', :action => 'show' },
19
- "http://#{country}.example.org/#{I18n.t('routes.namespace')}/#{I18n.t('routes.nesteds')}"
20
- )
21
-
22
- assert_recognizes(
23
- { :controller => 'simples', :action => 'show' },
24
- "http://#{country}.example.org/#{I18n.t('routes.simples')}"
25
- )
26
-
27
- assert_recognizes(
28
- { :controller => 'params', :action => 'show', :p1 => '1', :p2 => '2' },
29
- "http://#{country}.example.org/params/1/2"
30
- )
31
-
32
- assert_recognizes(
33
- { :controller => 'resources', :action => 'show' },
34
- "http://#{country}.example.org/#{I18n.t('routes.resources')}"
35
- )
36
-
37
- end
38
- end
39
- end
40
- end
41
-
42
- test "should translate prefix routes" do
43
- with_routes_type :prefix do
44
- I18n.available_locales.select{|l|l!=:en}.each do |locale|
45
- I18n.locale = locale
46
-
47
- assert_recognizes(
48
- { :controller => 'namespace/nesteds', :action => 'show', :locale => locale.to_s },
49
- "/#{locale}/#{I18n.t('routes.namespace')}/#{I18n.t('routes.nesteds')}"
50
- )
51
-
52
- assert_recognizes(
53
- { :controller => 'namespace/nesteds_resources', :action => 'show', :locale => locale.to_s },
54
- "/#{locale}/#{I18n.t('routes.namespace')}/#{I18n.t('routes.nesteds_resources')}"
55
- )
56
-
57
- assert_recognizes(
58
- { :controller => 'simples', :action => 'show', :locale => locale.to_s },
59
- "/#{locale}/#{I18n.t('routes.simples')}"
60
- )
61
-
62
- assert_recognizes(
63
- { :controller => 'params', :action => 'show', :locale => locale.to_s, :p1 => '1', :p2 => '2' },
64
- "/#{locale}/params/1/2"
65
- )
66
-
67
- assert_recognizes(
68
- { :controller => 'resources', :action => 'show', :locale => locale.to_s },
69
- "/#{locale}/#{I18n.t('routes.resources')}"
70
- )
71
-
72
- end
73
- end
74
- end
75
-
76
- protected
77
-
78
- def with_routes_type(type)
79
- Rails.application.config.i18n_routes.selection = type
80
- with_routing do |set|
81
- set.draw do
82
- localized do
83
- namespace :namespace do
84
- match 'nesteds' => 'nesteds#show', :as => :nesteds
85
- resource :nesteds_resources
86
- end
87
- match 'simples' => 'simples#show', :as => :simples
88
- match 'params/:p1/:p2' => 'params#show', :as => :params
89
- resource :resources
90
- end
91
- end
92
- yield
93
- end
94
- end
95
-
96
- end
@@ -1,34 +0,0 @@
1
- require 'test_helper'
2
-
3
- class SelectionTest < ActionController::TestCase
4
- tests SimplesController
5
-
6
- test "should select correct locale by subdomain" do
7
- Rails.application.config.i18n_routes.selection = :subdomain
8
- subdomains = []
9
- Rails.application.config.i18n_routes.mapping.each_pair do |lang, countries|
10
- countries = [countries] unless countries.is_a? Array
11
- countries.each do |country|
12
-
13
- @request.host = "#{country}.example.org"
14
- get :show
15
- assert_equal I18n.locale.to_s, "#{lang}-#{country.upcase}"
16
-
17
- subdomains << country
18
-
19
- end
20
- end
21
- assert_equal @controller.send(:subdomains), subdomains
22
- end
23
-
24
- test "should select correct locale by prefix" do
25
- Rails.application.config.i18n_routes.selection = :prefix
26
- I18n.available_locales.select{|l|l!=:en}.each do |locale|
27
-
28
- get :show, :locale => locale.to_s
29
- assert_equal I18n.locale.to_s, locale.to_s
30
-
31
- end
32
- end
33
-
34
- end
data/test/test_helper.rb DELETED
@@ -1,15 +0,0 @@
1
- # Configure Rails Environment
2
- ENV['RAILS_ENV'] = 'test'
3
-
4
- require File.expand_path('../dummy/config/environment.rb', __FILE__)
5
- require 'rails/test_help'
6
-
7
- Rails.backtrace_cleaner.remove_silencers!
8
-
9
- # Load support files
10
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
-
12
- # Load fixtures from the engine
13
- if ActiveSupport::TestCase.method_defined?(:fixture_path=)
14
- ActiveSupport::TestCase.fixture_path = File.expand_path('../fixtures', __FILE__)
15
- end