sinatra-r18n 2.0.4 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/spec/sinatra-r18n_spec.rb +25 -1
  4. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9285f88a5ade1f6c850d9de0063de9256a99b9b
4
- data.tar.gz: e764bc3d49a3c5422cf5c4a78fee5542bf54dd0f
3
+ metadata.gz: 8241e09100d6bf1426b7297658b0171b3de4d10e
4
+ data.tar.gz: 0f515ff11d71ef514f3d48a5394bcd04065442a3
5
5
  SHA512:
6
- metadata.gz: 823e201e910b6361e4c94be7d370f2363f88c53a155e1a24435b107e2c75830439f179409d9584476927289d8517e79334a7c9f3d0a2c9336afd18f361867e28
7
- data.tar.gz: ba4aed89faafbbd1e0fc344b4a2902f249539903861f531149ca196b328177ab0e8fb5ad800ab6bfcb91237fdbb72c9c6c85901f0ea37901d741bcfaaa3d22c8
6
+ metadata.gz: 68a179486a9d012feff4924572e79d1e9d6e0f6a68d6f56ceca3514edf1bfaf6a915fcf13a1f6f697dd6615eed8a4f364114ca506860461363bb15e376ed8f9c
7
+ data.tar.gz: c513c5b3e179c06815cd8ae522d0679d543812bd1a50cbd31f331849c3ee77c3808b5b24899773ceafa78beda247e764ab0f568f26ac0e1e9a4b38a2d51c3b6b
data/README.md CHANGED
@@ -25,7 +25,7 @@ information.
25
25
  ```yaml
26
26
  post:
27
27
  friends: Post only for friends
28
- tags: Post tags is %1
28
+ tags: Post tags are %1
29
29
 
30
30
  comments: !!pl
31
31
  0: No comments
@@ -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
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-04-22 00:00:00.000000000 Z
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.4
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.4
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.