lazier 4.0.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis-gemfile +1 -2
- data/Gemfile +1 -2
- data/doc/Lazier/Boolean.html +1 -1
- data/doc/Lazier/Configuration.html +1 -1
- data/doc/Lazier/DateTime/ClassMethods.html +1 -1
- data/doc/Lazier/DateTime.html +1 -1
- data/doc/Lazier/Exceptions/Debug.html +1 -1
- data/doc/Lazier/Exceptions/MissingTranslation.html +1 -1
- data/doc/Lazier/Exceptions/TranslationExceptionHandler.html +1 -1
- data/doc/Lazier/Exceptions.html +1 -1
- data/doc/Lazier/Hash.html +1 -1
- data/doc/Lazier/I18n.html +34 -24
- data/doc/Lazier/Math/ClassMethods.html +1 -1
- data/doc/Lazier/Math.html +1 -1
- data/doc/Lazier/Object.html +1 -1
- data/doc/Lazier/Pathname.html +1 -1
- data/doc/Lazier/Settings.html +172 -34
- data/doc/Lazier/String.html +1 -1
- data/doc/Lazier/TimeZone/ClassMethods.html +1 -1
- data/doc/Lazier/TimeZone.html +1 -1
- data/doc/Lazier/Version.html +2 -2
- data/doc/Lazier.html +83 -75
- data/doc/_index.html +1 -1
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/doc/top-level-namespace.html +1 -1
- data/lazier.gemspec +1 -1
- data/lib/lazier/i18n.rb +1 -0
- data/lib/lazier/settings.rb +15 -2
- data/lib/lazier/version.rb +1 -1
- data/lib/lazier.rb +40 -32
- data/spec/lazier/boolean_spec.rb +1 -1
- data/spec/lazier/datetime_spec.rb +1 -1
- data/spec/lazier/hash_spec.rb +2 -2
- data/spec/lazier/i18n_spec.rb +17 -11
- data/spec/lazier/math_spec.rb +1 -1
- data/spec/lazier/object_spec.rb +1 -1
- data/spec/lazier/pathname_spec.rb +1 -1
- data/spec/lazier/settings_spec.rb +1 -1
- data/spec/lazier/string_spec.rb +1 -1
- data/spec/lazier/timezone_spec.rb +1 -1
- metadata +4 -4
data/spec/lazier/i18n_spec.rb
CHANGED
@@ -6,10 +6,20 @@
|
|
6
6
|
require "spec_helper"
|
7
7
|
|
8
8
|
describe Lazier::I18n do
|
9
|
-
before(:
|
9
|
+
before(:all) do
|
10
10
|
Lazier::I18n.default_locale = :en
|
11
11
|
end
|
12
12
|
|
13
|
+
before(:each) do |example|
|
14
|
+
unless example.metadata[:skip_locale_whitelist]
|
15
|
+
::I18n.locale = :en
|
16
|
+
allow(::I18n).to receive("locale=")
|
17
|
+
Lazier::I18n.default_locale = nil
|
18
|
+
else
|
19
|
+
Lazier::I18n.default_locale = :en
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
13
23
|
subject! { Lazier::I18n.instance(force: true) }
|
14
24
|
|
15
25
|
describe ".instance" do
|
@@ -33,17 +43,11 @@ describe Lazier::I18n do
|
|
33
43
|
end
|
34
44
|
|
35
45
|
it "should fallback to the default locale" do
|
36
|
-
allow(::I18n).to receive("locale=")
|
37
46
|
Lazier::I18n.default_locale = "pt"
|
38
47
|
expect(Lazier::I18n.new.locale).to eq(:pt)
|
39
48
|
end
|
40
49
|
|
41
50
|
describe "should fallback to the system locale" do
|
42
|
-
before(:each) do
|
43
|
-
allow(::I18n).to receive("locale=")
|
44
|
-
Lazier::I18n.default_locale = nil
|
45
|
-
end
|
46
|
-
|
47
51
|
it "in JRuby" do
|
48
52
|
expect(Lazier).to receive(:platform).exactly(2).and_return(:java)
|
49
53
|
|
@@ -105,6 +109,8 @@ describe Lazier::I18n do
|
|
105
109
|
|
106
110
|
describe "#translations" do
|
107
111
|
it "should return the list of translations" do
|
112
|
+
subject.locale = "en"
|
113
|
+
subject.reload
|
108
114
|
expect(subject.translations.keys).to eq([:date, :time, :support, :number, :lazier])
|
109
115
|
end
|
110
116
|
end
|
@@ -112,7 +118,7 @@ describe Lazier::I18n do
|
|
112
118
|
describe "#locale=" do
|
113
119
|
it "should assign the new locale" do
|
114
120
|
expect(::I18n).to receive("locale=").with(:it)
|
115
|
-
subject.locale =
|
121
|
+
subject.locale = :it
|
116
122
|
expect(subject.locale).to eq(:it)
|
117
123
|
end
|
118
124
|
end
|
@@ -132,13 +138,13 @@ describe Lazier::I18n do
|
|
132
138
|
end
|
133
139
|
|
134
140
|
describe "#translate_in_locale" do
|
135
|
-
it "should return the translation in the desired locale" do
|
141
|
+
it "should return the translation in the desired locale", skip_locale_whitelist: true do
|
136
142
|
expect(subject.translate_in_locale(:it, "configuration.not_defined", name: "foo", class: "bar")).to eq("La proprietà foo non è definita per bar.")
|
137
143
|
end
|
138
144
|
end
|
139
145
|
|
140
146
|
describe "#with_locale" do
|
141
|
-
it "should execute a block with the new locale and then set the old locale back" do
|
147
|
+
it "should execute a block with the new locale and then set the old locale back", skip_locale_whitelist: true do
|
142
148
|
new_locale = nil
|
143
149
|
|
144
150
|
subject.with_locale(:it) do
|
@@ -149,7 +155,7 @@ describe Lazier::I18n do
|
|
149
155
|
expect(subject.locale).to eq(:en)
|
150
156
|
end
|
151
157
|
|
152
|
-
it "should raise exception after having restored the old locale" do
|
158
|
+
it "should raise exception after having restored the old locale", skip_locale_whitelist: true do
|
153
159
|
new_locale = nil
|
154
160
|
|
155
161
|
expect {
|
data/spec/lazier/math_spec.rb
CHANGED
data/spec/lazier/object_spec.rb
CHANGED
data/spec/lazier/string_spec.rb
CHANGED
@@ -11,7 +11,7 @@ describe Lazier::TimeZone do
|
|
11
11
|
let(:zone_without_dst) { ::ActiveSupport::TimeZone["International Date Line West"] }
|
12
12
|
|
13
13
|
before(:all) do
|
14
|
-
::Lazier.load!
|
14
|
+
::Lazier.load!(:datetime)
|
15
15
|
::Time.zone = ::ActiveSupport::TimeZone["Mountain Time (US & Canada)"]
|
16
16
|
end
|
17
17
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lazier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shogun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '3.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: '
|
40
|
+
version: '3.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: oj
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|