rails-localization 0.2.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +1,16 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'test_app', 'config', 'environment')
2
+ require 'rails/test_help'
3
+ require 'capybara/rails'
4
+
1
5
  module CapybaraHelper
2
6
  def self.included(base)
3
7
  base.class_eval do
4
8
  include Capybara::DSL
5
- end
6
- end
7
9
 
8
- def after_teardown
9
- Capybara.reset_sessions!
10
- Capybara.use_default_driver
10
+ teardown do
11
+ Capybara.reset_sessions!
12
+ Capybara.use_default_driver
13
+ end
14
+ end
11
15
  end
12
16
  end
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "rails", ">= 3.0.0", "< 4.0.0"
4
+ gem "rails-localization", path: "../../../rails-localization"
@@ -0,0 +1,93 @@
1
+ PATH
2
+ remote: ../../../rails-localization
3
+ specs:
4
+ rails-localization (1.0.0)
5
+ i18n
6
+ rails (>= 3.0.0, < 4.0.0)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ actionmailer (3.2.15)
12
+ actionpack (= 3.2.15)
13
+ mail (~> 2.5.4)
14
+ actionpack (3.2.15)
15
+ activemodel (= 3.2.15)
16
+ activesupport (= 3.2.15)
17
+ builder (~> 3.0.0)
18
+ erubis (~> 2.7.0)
19
+ journey (~> 1.0.4)
20
+ rack (~> 1.4.5)
21
+ rack-cache (~> 1.2)
22
+ rack-test (~> 0.6.1)
23
+ sprockets (~> 2.2.1)
24
+ activemodel (3.2.15)
25
+ activesupport (= 3.2.15)
26
+ builder (~> 3.0.0)
27
+ activerecord (3.2.15)
28
+ activemodel (= 3.2.15)
29
+ activesupport (= 3.2.15)
30
+ arel (~> 3.0.2)
31
+ tzinfo (~> 0.3.29)
32
+ activeresource (3.2.15)
33
+ activemodel (= 3.2.15)
34
+ activesupport (= 3.2.15)
35
+ activesupport (3.2.15)
36
+ i18n (~> 0.6, >= 0.6.4)
37
+ multi_json (~> 1.0)
38
+ arel (3.0.3)
39
+ builder (3.0.4)
40
+ erubis (2.7.0)
41
+ hike (1.2.3)
42
+ i18n (0.6.5)
43
+ journey (1.0.4)
44
+ json (1.8.1)
45
+ mail (2.5.4)
46
+ mime-types (~> 1.16)
47
+ treetop (~> 1.4.8)
48
+ mime-types (1.25.1)
49
+ multi_json (1.8.2)
50
+ polyglot (0.3.3)
51
+ rack (1.4.5)
52
+ rack-cache (1.2)
53
+ rack (>= 0.4)
54
+ rack-ssl (1.3.3)
55
+ rack
56
+ rack-test (0.6.2)
57
+ rack (>= 1.0)
58
+ rails (3.2.15)
59
+ actionmailer (= 3.2.15)
60
+ actionpack (= 3.2.15)
61
+ activerecord (= 3.2.15)
62
+ activeresource (= 3.2.15)
63
+ activesupport (= 3.2.15)
64
+ bundler (~> 1.0)
65
+ railties (= 3.2.15)
66
+ railties (3.2.15)
67
+ actionpack (= 3.2.15)
68
+ activesupport (= 3.2.15)
69
+ rack-ssl (~> 1.3.2)
70
+ rake (>= 0.8.7)
71
+ rdoc (~> 3.4)
72
+ thor (>= 0.14.6, < 2.0)
73
+ rake (10.1.0)
74
+ rdoc (3.12.2)
75
+ json (~> 1.4)
76
+ sprockets (2.2.2)
77
+ hike (~> 1.2)
78
+ multi_json (~> 1.0)
79
+ rack (~> 1.0)
80
+ tilt (~> 1.1, != 1.3.0)
81
+ thor (0.18.1)
82
+ tilt (1.4.1)
83
+ treetop (1.4.15)
84
+ polyglot
85
+ polyglot (>= 0.3.1)
86
+ tzinfo (0.3.38)
87
+
88
+ PLATFORMS
89
+ ruby
90
+
91
+ DEPENDENCIES
92
+ rails (>= 3.0.0, < 4.0.0)
93
+ rails-localization!
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ TestApp::Application.load_tasks
@@ -8,7 +8,7 @@ class UsersController < ApplicationController
8
8
  end
9
9
 
10
10
  def without_locale
11
- render :text => users_path(:locale => false), :layout => false
11
+ render :text => users_path, :layout => false
12
12
  end
13
13
 
14
14
  def with_defined_locale
@@ -2,9 +2,8 @@ require File.expand_path('../boot', __FILE__)
2
2
 
3
3
  require "action_controller/railtie"
4
4
  require "action_mailer/railtie"
5
- require "active_resource/railtie"
6
- require "rails/test_unit/railtie"
7
5
  require "sprockets/railtie"
6
+ require "rails/test_unit/railtie"
8
7
 
9
8
  if defined?(Bundler)
10
9
  # If you precompile assets before deploying to production, use this line
@@ -62,8 +61,6 @@ module TestApp
62
61
 
63
62
  # Version of your assets, change this if you want to expire all your assets
64
63
  config.assets.version = '1.0'
65
-
66
- config.middleware.use "Rails::Localization::Middleware", %w(en ru)
67
64
  end
68
65
  end
69
66
 
@@ -7,7 +7,7 @@ TestApp::Application.configure do
7
7
  config.cache_classes = false
8
8
 
9
9
  # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
10
+ config.eager_load = false
11
11
 
12
12
  # Show full error reports and disable caching
13
13
  config.consider_all_requests_local = true
@@ -23,11 +23,11 @@ TestApp::Application.configure do
23
23
  config.action_dispatch.best_standards_support = :builtin
24
24
 
25
25
  # Raise exception on mass assignment protection for Active Record models
26
- config.active_record.mass_assignment_sanitizer = :strict
26
+ #config.active_record.mass_assignment_sanitizer = :strict
27
27
 
28
28
  # Log the query plan for queries taking more than this (works
29
29
  # with SQLite, MySQL, and PostgreSQL)
30
- config.active_record.auto_explain_threshold_in_seconds = 0.5
30
+ #config.active_record.auto_explain_threshold_in_seconds = 0.5
31
31
 
32
32
  # Do not compress assets
33
33
  config.assets.compress = false
@@ -20,6 +20,8 @@ TestApp::Application.configure do
20
20
  # Generate digests for assets URLs
21
21
  config.assets.digest = true
22
22
 
23
+ config.eager_load = true
24
+
23
25
  # Defaults to nil and saved in location specified by config.assets.prefix
24
26
  # config.assets.manifest = YOUR_PATH
25
27
 
@@ -7,13 +7,12 @@ TestApp::Application.configure do
7
7
  # and recreated between test runs. Don't rely on the data there!
8
8
  config.cache_classes = true
9
9
 
10
+ config.eager_load = false
11
+
10
12
  # Configure static asset server for tests with Cache-Control for performance
11
13
  config.serve_static_assets = true
12
14
  config.static_cache_control = "public, max-age=3600"
13
15
 
14
- # Log error messages when you accidentally call methods on nil
15
- config.whiny_nils = true
16
-
17
16
  # Show full error reports and disable caching
18
17
  config.consider_all_requests_local = true
19
18
  config.action_controller.perform_caching = false
@@ -7,13 +7,16 @@ SubApp::Engine.routes.draw do
7
7
  end
8
8
 
9
9
  TestApp::Application.routes.draw do
10
- mount SubApp::Engine => '/sub', :as => :sub_app_engine
10
+ localized({"en" => "English", "ru" => "Russian"}) do
11
+ mount SubApp::Engine => '/sub', :as => :sub_app_engine
11
12
 
12
- get :users, :to => "users#index"
13
- get "users/with_locale", :to => "users#with_locale"
14
- get "users/without_locale", :to => "users#without_locale"
15
- get "users/with_defined_locale", :to => "users#with_defined_locale"
16
- get :welcome, :to => 'main#welcome'
13
+ get :users, :to => "users#index"
14
+ get "users/with_locale", :to => "users#with_locale"
15
+ get :welcome, :to => 'main#welcome'
17
16
 
18
- root :to => 'main#index'
17
+ root :to => 'main#index'
18
+ end
19
+
20
+ get "users/without_locale", :to => "users#without_locale"
21
+ get "users/with_defined_locale", :to => "users#with_defined_locale", locale: "en"
19
22
  end
data/test/test_helper.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'bundler'
2
2
  require 'rack/test'
3
- require 'test/unit'
4
- require 'ruby-debug'
3
+ require 'test-unit'
4
+ require 'shoulda/context'
5
5
 
6
6
  Bundler.setup(:default, :test)
7
7
 
@@ -9,12 +9,7 @@ ENV["RAILS_ENV"] = "test"
9
9
 
10
10
  $LOAD_PATH.unshift(File.dirname(__FILE__))
11
11
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
12
- require 'rails-localization'
13
-
14
- require File.join(File.dirname(__FILE__), 'test_app', 'config', 'environment')
15
- require File.expand_path("support/capybara_helper", File.dirname(__FILE__))
16
12
 
17
- require 'rails/test_help'
18
- require 'capybara/rails'
13
+ require 'rails-localization'
19
14
 
20
15
  I18n.locale = :en
@@ -1,26 +1,18 @@
1
1
  # encoding: utf-8
2
2
  require File.expand_path("test_helper", File.dirname(__FILE__))
3
+ require File.expand_path("support/capybara_helper", File.dirname(__FILE__))
3
4
 
4
5
  class UrlsOverwritingTest < ActionController::TestCase
5
-
6
6
  def teardown
7
7
  ::I18n.locale = ::I18n.default_locale
8
8
  end
9
9
 
10
- # test "root" do
11
- # assert_generates("/", :controller => "main", :action => "index")
12
- # ::I18n.locale = :en
13
- # assert_generates("/", :controller => "main", :action => "index")
14
- # ::I18n.locale = :ru
15
- # assert_generates("/", :controller => "main", :action => "index", :locale => false)
16
- # assert_generates("/", :controller => "main", :action => "index", :locale => :en)
17
- # assert_generates("/", :controller => "main", :action => "index", :locale => "en")
18
- # assert_generates("/ru/", :controller => "main", :action => "index")
19
- # end
20
-
21
- # test "incorrect locale" do
22
- # assert_raises Rails::Localization::UnknownLocaleError do
23
- # assert_generates("/", :controller => "main", :action => "index", :locale => :de)
24
- # end
25
- # end
10
+ test "root" do
11
+ assert_generates("/", :controller => "main", :action => "index")
12
+ ::I18n.locale = :en
13
+ assert_generates("/", :controller => "main", :action => "index")
14
+ assert_generates("/en", :controller => "main", :action => "index", :locale => "en")
15
+ ::I18n.locale = :ru
16
+ assert_generates("/ru", :controller => "main", :action => "index", :locale => "ru")
17
+ end
26
18
  end
metadata CHANGED
@@ -1,159 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-localization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
5
- prerelease:
4
+ version: 1.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - E-Max
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-25 00:00:00.000000000Z
11
+ date: 2014-01-31 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
16
- requirement: &77360150 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
- version: '0'
19
+ version: 4.0.0
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *77360150
25
- - !ruby/object:Gem::Dependency
26
- name: localization-middleware
27
- requirement: &77146830 !ruby/object:Gem::Requirement
28
- none: false
22
+ version_requirements: !ruby/object:Gem::Requirement
29
23
  requirements:
30
- - - ! '>='
24
+ - - '>='
31
25
  - !ruby/object:Gem::Version
32
- version: '0'
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: *77146830
26
+ version: 4.0.0
36
27
  - !ruby/object:Gem::Dependency
37
28
  name: i18n
38
- requirement: &77146440 !ruby/object:Gem::Requirement
39
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
40
30
  requirements:
41
- - - ! '>='
31
+ - - '>='
42
32
  - !ruby/object:Gem::Version
43
33
  version: '0'
44
34
  type: :runtime
45
35
  prerelease: false
46
- version_requirements: *77146440
47
- - !ruby/object:Gem::Dependency
48
- name: test-unit
49
- requirement: &77145760 !ruby/object:Gem::Requirement
50
- none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- type: :development
56
- prerelease: false
57
- version_requirements: *77145760
58
- - !ruby/object:Gem::Dependency
59
- name: test-spec
60
- requirement: &77145250 !ruby/object:Gem::Requirement
61
- none: false
36
+ version_requirements: !ruby/object:Gem::Requirement
62
37
  requirements:
63
- - - ! '>='
38
+ - - '>='
64
39
  - !ruby/object:Gem::Version
65
40
  version: '0'
66
- type: :development
67
- prerelease: false
68
- version_requirements: *77145250
69
- - !ruby/object:Gem::Dependency
70
- name: shoulda
71
- requirement: &77144810 !ruby/object:Gem::Requirement
72
- none: false
73
- requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :development
78
- prerelease: false
79
- version_requirements: *77144810
80
- - !ruby/object:Gem::Dependency
81
- name: yard
82
- requirement: &77144340 !ruby/object:Gem::Requirement
83
- none: false
84
- requirements:
85
- - - ~>
86
- - !ruby/object:Gem::Version
87
- version: 0.6.0
88
- type: :development
89
- prerelease: false
90
- version_requirements: *77144340
91
41
  - !ruby/object:Gem::Dependency
92
42
  name: jeweler
93
- requirement: &77143800 !ruby/object:Gem::Requirement
94
- none: false
43
+ requirement: !ruby/object:Gem::Requirement
95
44
  requirements:
96
45
  - - ~>
97
46
  - !ruby/object:Gem::Version
98
- version: 1.6.4
47
+ version: 1.8.0
99
48
  type: :development
100
49
  prerelease: false
101
- version_requirements: *77143800
102
- - !ruby/object:Gem::Dependency
103
- name: simplecov
104
- requirement: &77143340 !ruby/object:Gem::Requirement
105
- none: false
50
+ version_requirements: !ruby/object:Gem::Requirement
106
51
  requirements:
107
52
  - - ~>
108
53
  - !ruby/object:Gem::Version
109
- version: 0.6.4
110
- type: :development
111
- prerelease: false
112
- version_requirements: *77143340
113
- - !ruby/object:Gem::Dependency
114
- name: rcov
115
- requirement: &77142970 !ruby/object:Gem::Requirement
116
- none: false
117
- requirements:
118
- - - ~>
119
- - !ruby/object:Gem::Version
120
- version: 1.0.0
121
- type: :development
122
- prerelease: false
123
- version_requirements: *77142970
124
- - !ruby/object:Gem::Dependency
125
- name: debugger
126
- requirement: &77142600 !ruby/object:Gem::Requirement
127
- none: false
128
- requirements:
129
- - - ~>
130
- - !ruby/object:Gem::Version
131
- version: 1.1.3
132
- type: :development
133
- prerelease: false
134
- version_requirements: *77142600
135
- - !ruby/object:Gem::Dependency
136
- name: ruby-debug
137
- requirement: &77142220 !ruby/object:Gem::Requirement
138
- none: false
139
- requirements:
140
- - - ! '>='
141
- - !ruby/object:Gem::Version
142
- version: '0'
143
- type: :development
144
- prerelease: false
145
- version_requirements: *77142220
146
- - !ruby/object:Gem::Dependency
147
- name: capybara
148
- requirement: &77141600 !ruby/object:Gem::Requirement
149
- none: false
150
- requirements:
151
- - - ! '>='
152
- - !ruby/object:Gem::Version
153
- version: '0'
154
- type: :development
155
- prerelease: false
156
- version_requirements: *77141600
54
+ version: 1.8.0
157
55
  description: This gem allows you to localize your rails application with ease
158
56
  email: max@studentify.nl
159
57
  executables: []
@@ -163,7 +61,8 @@ extra_rdoc_files:
163
61
  - README.rdoc
164
62
  files:
165
63
  - .document
166
- - .rvmrc
64
+ - .ruby-gemset
65
+ - .ruby-version
167
66
  - .travis.yml
168
67
  - Gemfile
169
68
  - Gemfile.lock
@@ -172,13 +71,22 @@ files:
172
71
  - Rakefile
173
72
  - VERSION
174
73
  - lib/rails-localization.rb
175
- - lib/rails-localization/middleware.rb
176
- - lib/rails-localization/routes_set_ext.rb
74
+ - lib/rails-localization/controller.rb
75
+ - lib/rails-localization/engine.rb
76
+ - lib/rails-localization/i18n.rb
77
+ - lib/rails-localization/route_set.rb
78
+ - lib/rails-localization/router.rb
79
+ - lib/rails-localization/url_options.rb
177
80
  - lib/rails_localization.rb
178
81
  - rails-localization.gemspec
82
+ - test/i18n_integration_test.rb
83
+ - test/mapper_integration_test.rb
179
84
  - test/rails-localization_test.rb
180
85
  - test/support/capybara_helper.rb
181
86
  - test/test_app/.gitignore
87
+ - test/test_app/Gemfile
88
+ - test/test_app/Gemfile.lock
89
+ - test/test_app/Rakefile
182
90
  - test/test_app/app/assets/images/rails.png
183
91
  - test/test_app/app/assets/javascripts/application.js
184
92
  - test/test_app/app/assets/stylesheets/application.css
@@ -218,29 +126,25 @@ files:
218
126
  homepage: http://github.com/kot-begemot/rails-localization
219
127
  licenses:
220
128
  - MIT
129
+ metadata: {}
221
130
  post_install_message:
222
131
  rdoc_options: []
223
132
  require_paths:
224
133
  - lib
225
134
  required_ruby_version: !ruby/object:Gem::Requirement
226
- none: false
227
135
  requirements:
228
- - - ! '>='
136
+ - - '>='
229
137
  - !ruby/object:Gem::Version
230
138
  version: '0'
231
- segments:
232
- - 0
233
- hash: -403332335
234
139
  required_rubygems_version: !ruby/object:Gem::Requirement
235
- none: false
236
140
  requirements:
237
- - - ! '>='
141
+ - - '>='
238
142
  - !ruby/object:Gem::Version
239
143
  version: '0'
240
144
  requirements: []
241
145
  rubyforge_project:
242
- rubygems_version: 1.8.10
146
+ rubygems_version: 2.2.1
243
147
  signing_key:
244
- specification_version: 3
148
+ specification_version: 4
245
149
  summary: Rails localization Gem
246
150
  test_files: []