rails-localization 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "rails-localization"
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["E-Max"]
@@ -77,4 +77,40 @@ class RailsLocalizationTest < ActionDispatch::IntegrationTest
77
77
  assert page.has_content? "translation missing: ru.users.index"
78
78
  end
79
79
  end
80
+
81
+ context "user path" do
82
+ def test_locale_included_into_users_path
83
+ visit "/users/with_locale"
84
+ assert_equal "/users", page.source, "Page body was: #{page.body}"
85
+
86
+ visit "/en/users/with_locale"
87
+ assert_equal "/users", page.source, "Page body was: #{page.body}"
88
+
89
+ visit "/ru/users/with_locale"
90
+ assert_equal "/ru/users", page.source, "Page body was: #{page.body}"
91
+ end
92
+
93
+ def test_locale_ignored_in_users_path
94
+ visit "/users/without_locale"
95
+ assert_equal "/users", page.source, "Page body was: #{page.body}"
96
+
97
+ visit "/en/users/without_locale"
98
+ assert_equal "/users", page.source, "Page body was: #{page.body}"
99
+
100
+ visit "/ru/users/without_locale"
101
+ assert_equal "/users", page.source, "Page body was: #{page.body}"
102
+ end
103
+
104
+ def test_locale_forced_in_users_path
105
+ visit "/users/with_defined_locale"
106
+ assert_equal "/ru/users", page.source, "Page body was: #{page.body}"
107
+
108
+ visit "/en/users/with_defined_locale"
109
+ assert_equal "/ru/users", page.source, "Page body was: #{page.body}"
110
+
111
+ visit "/ru/users/with_defined_locale"
112
+ assert_equal "/ru/users", page.source, "Page body was: #{page.body}"
113
+ end
114
+
115
+ end
80
116
  end
@@ -3,9 +3,16 @@ class UsersController < ApplicationController
3
3
  render :text => t('users.index')
4
4
  end
5
5
 
6
+ def with_locale
7
+ render :text => users_path, :layout => false
8
+ end
9
+
10
+ def without_locale
11
+ render :text => users_path(:locale => false), :layout => false
12
+ end
6
13
 
7
- def new
8
- render :text => users_path
14
+ def with_defined_locale
15
+ render :text => users_path(:locale => :ru), :layout => false
9
16
  end
10
17
  end
11
18
 
@@ -1,5 +1,8 @@
1
1
  TestApp::Application.routes.draw do
2
- resources :users
2
+ get :users, :to => "users#index"
3
+ get "users/with_locale", :to => "users#with_locale"
4
+ get "users/without_locale", :to => "users#without_locale"
5
+ get "users/with_defined_locale", :to => "users#with_defined_locale"
3
6
  get :welcome, :to => 'main#welcome'
4
7
 
5
8
  root :to => 'main#index'
@@ -23,9 +23,4 @@ class UrlsOverwritingTest < ActionController::TestCase
23
23
  assert_generates("/", :controller => "main", :action => "index", :locale => :de)
24
24
  end
25
25
  end
26
-
27
- # test "routing" do
28
- # assert_equal '/', TestApp::Application.routes.url_for
29
- # end
30
-
31
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-localization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-09-10 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &78203240 !ruby/object:Gem::Requirement
16
+ requirement: &84016770 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *78203240
24
+ version_requirements: *84016770
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: localization-middleware
27
- requirement: &78202930 !ruby/object:Gem::Requirement
27
+ requirement: &84016390 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *78202930
35
+ version_requirements: *84016390
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: i18n
38
- requirement: &78202510 !ruby/object:Gem::Requirement
38
+ requirement: &84015980 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *78202510
46
+ version_requirements: *84015980
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: test-unit
49
- requirement: &78202130 !ruby/object:Gem::Requirement
49
+ requirement: &84015370 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *78202130
57
+ version_requirements: *84015370
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: test-spec
60
- requirement: &78201750 !ruby/object:Gem::Requirement
60
+ requirement: &84015010 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *78201750
68
+ version_requirements: *84015010
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: shoulda
71
- requirement: &78201150 !ruby/object:Gem::Requirement
71
+ requirement: &84014440 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *78201150
79
+ version_requirements: *84014440
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: yard
82
- requirement: &78200420 !ruby/object:Gem::Requirement
82
+ requirement: &84013960 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 0.6.0
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *78200420
90
+ version_requirements: *84013960
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: jeweler
93
- requirement: &78199960 !ruby/object:Gem::Requirement
93
+ requirement: &84011820 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 1.6.4
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *78199960
101
+ version_requirements: *84011820
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: simplecov
104
- requirement: &78199470 !ruby/object:Gem::Requirement
104
+ requirement: &84011450 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: 0.6.4
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *78199470
112
+ version_requirements: *84011450
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: rcov
115
- requirement: &78198970 !ruby/object:Gem::Requirement
115
+ requirement: &84011090 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ~>
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: 1.0.0
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *78198970
123
+ version_requirements: *84011090
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: debugger
126
- requirement: &78198490 !ruby/object:Gem::Requirement
126
+ requirement: &84009630 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ~>
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: 1.1.3
132
132
  type: :development
133
133
  prerelease: false
134
- version_requirements: *78198490
134
+ version_requirements: *84009630
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: ruby-debug
137
- requirement: &78197940 !ruby/object:Gem::Requirement
137
+ requirement: &84009200 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ! '>='
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: '0'
143
143
  type: :development
144
144
  prerelease: false
145
- version_requirements: *78197940
145
+ version_requirements: *84009200
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: capybara
148
- requirement: &78197570 !ruby/object:Gem::Requirement
148
+ requirement: &84008810 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ! '>='
@@ -153,7 +153,7 @@ dependencies:
153
153
  version: '0'
154
154
  type: :development
155
155
  prerelease: false
156
- version_requirements: *78197570
156
+ version_requirements: *84008810
157
157
  description: This gem allows you to localize your rails application with ease
158
158
  email: max@studentify.nl
159
159
  executables: []
@@ -229,7 +229,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
229
229
  version: '0'
230
230
  segments:
231
231
  - 0
232
- hash: -787288623
232
+ hash: 811579485
233
233
  required_rubygems_version: !ruby/object:Gem::Requirement
234
234
  none: false
235
235
  requirements: