sinatra-r18n 2.0.4 → 2.1.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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/spec/sinatra-r18n_spec.rb +25 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8241e09100d6bf1426b7297658b0171b3de4d10e
|
4
|
+
data.tar.gz: 0f515ff11d71ef514f3d48a5394bcd04065442a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68a179486a9d012feff4924572e79d1e9d6e0f6a68d6f56ceca3514edf1bfaf6a915fcf13a1f6f697dd6615eed8a4f364114ca506860461363bb15e376ed8f9c
|
7
|
+
data.tar.gz: c513c5b3e179c06815cd8ae522d0679d543812bd1a50cbd31f331849c3ee77c3808b5b24899773ceafa78beda247e764ab0f568f26ac0e1e9a4b38a2d51c3b6b
|
data/README.md
CHANGED
data/spec/sinatra-r18n_spec.rb
CHANGED
@@ -30,17 +30,41 @@ describe Sinatra::R18n do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it "autodetects user locale" do
|
33
|
-
get '/locale', {}, {'HTTP_ACCEPT_LANGUAGE' => 'ru,en;q=0.9'}
|
33
|
+
get '/locale', { }, { 'HTTP_ACCEPT_LANGUAGE' => 'ru,en;q=0.9' }
|
34
34
|
expect(last_response).to be_ok
|
35
35
|
expect(last_response.body).to eq 'Русский'
|
36
36
|
end
|
37
37
|
|
38
|
+
it "uses locale from param" do
|
39
|
+
get '/locale', { locale: 'ru' }
|
40
|
+
expect(last_response).to be_ok
|
41
|
+
expect(last_response.body).to eq 'Русский'
|
42
|
+
end
|
43
|
+
|
44
|
+
it "ignore empty param" do
|
45
|
+
get '/locale', { locale: '' }
|
46
|
+
expect(last_response).to be_ok
|
47
|
+
expect(last_response.body).to eq 'English'
|
48
|
+
end
|
49
|
+
|
38
50
|
it "uses locale from session" do
|
39
51
|
get '/locale', { }, { 'rack.session' => { locale: 'ru' } }
|
40
52
|
expect(last_response).to be_ok
|
41
53
|
expect(last_response.body).to eq 'Русский'
|
42
54
|
end
|
43
55
|
|
56
|
+
it "ignore empty session" do
|
57
|
+
get '/locale', { }, { 'rack.session' => { locale: '' } }
|
58
|
+
expect(last_response).to be_ok
|
59
|
+
expect(last_response.body).to eq 'English'
|
60
|
+
end
|
61
|
+
|
62
|
+
it "ignores empty locale" do
|
63
|
+
get '/locale', { }
|
64
|
+
expect(last_response).to be_ok
|
65
|
+
expect(last_response.body).to eq 'English'
|
66
|
+
end
|
67
|
+
|
44
68
|
it "returns locales list" do
|
45
69
|
get '/locales'
|
46
70
|
expect(last_response).to be_ok
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-r18n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Sitnik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.0
|
33
|
+
version: 2.1.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.0
|
40
|
+
version: 2.1.0
|
41
41
|
description: |2
|
42
42
|
A Sinatra extension that provides i18n support to translate your web
|
43
43
|
application. It is just a wrapper for R18n core library.
|