lazier 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.travis-gemfile +1 -2
  3. data/Gemfile +1 -2
  4. data/doc/Lazier/Boolean.html +1 -1
  5. data/doc/Lazier/Configuration.html +1 -1
  6. data/doc/Lazier/DateTime/ClassMethods.html +1 -1
  7. data/doc/Lazier/DateTime.html +1 -1
  8. data/doc/Lazier/Exceptions/Debug.html +1 -1
  9. data/doc/Lazier/Exceptions/MissingTranslation.html +1 -1
  10. data/doc/Lazier/Exceptions/TranslationExceptionHandler.html +1 -1
  11. data/doc/Lazier/Exceptions.html +1 -1
  12. data/doc/Lazier/Hash.html +1 -1
  13. data/doc/Lazier/I18n.html +34 -24
  14. data/doc/Lazier/Math/ClassMethods.html +1 -1
  15. data/doc/Lazier/Math.html +1 -1
  16. data/doc/Lazier/Object.html +1 -1
  17. data/doc/Lazier/Pathname.html +1 -1
  18. data/doc/Lazier/Settings.html +172 -34
  19. data/doc/Lazier/String.html +1 -1
  20. data/doc/Lazier/TimeZone/ClassMethods.html +1 -1
  21. data/doc/Lazier/TimeZone.html +1 -1
  22. data/doc/Lazier/Version.html +2 -2
  23. data/doc/Lazier.html +83 -75
  24. data/doc/_index.html +1 -1
  25. data/doc/file.README.html +1 -1
  26. data/doc/index.html +1 -1
  27. data/doc/top-level-namespace.html +1 -1
  28. data/lazier.gemspec +1 -1
  29. data/lib/lazier/i18n.rb +1 -0
  30. data/lib/lazier/settings.rb +15 -2
  31. data/lib/lazier/version.rb +1 -1
  32. data/lib/lazier.rb +40 -32
  33. data/spec/lazier/boolean_spec.rb +1 -1
  34. data/spec/lazier/datetime_spec.rb +1 -1
  35. data/spec/lazier/hash_spec.rb +2 -2
  36. data/spec/lazier/i18n_spec.rb +17 -11
  37. data/spec/lazier/math_spec.rb +1 -1
  38. data/spec/lazier/object_spec.rb +1 -1
  39. data/spec/lazier/pathname_spec.rb +1 -1
  40. data/spec/lazier/settings_spec.rb +1 -1
  41. data/spec/lazier/string_spec.rb +1 -1
  42. data/spec/lazier/timezone_spec.rb +1 -1
  43. metadata +4 -4
@@ -6,10 +6,20 @@
6
6
  require "spec_helper"
7
7
 
8
8
  describe Lazier::I18n do
9
- before(:each) do
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 = "it"
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 {
@@ -11,7 +11,7 @@ describe Lazier::Math do
11
11
  let(:third) { 0 }
12
12
 
13
13
  before(:all) do
14
- ::Lazier.load!
14
+ ::Lazier.load!(:math)
15
15
  end
16
16
 
17
17
  describe "::min" do
@@ -7,7 +7,7 @@ require "spec_helper"
7
7
 
8
8
  describe Lazier::Object do
9
9
  before(:all) do
10
- ::Lazier.load!
10
+ ::Lazier.load!(:object)
11
11
  end
12
12
 
13
13
  describe "#normalize_number" do
@@ -9,7 +9,7 @@ describe Lazier::Pathname do
9
9
  subject { ::Pathname.new($0) }
10
10
 
11
11
  before(:all) do
12
- ::Lazier.load!
12
+ ::Lazier.load!(:pathname)
13
13
  end
14
14
 
15
15
  describe "#components" do
@@ -11,7 +11,7 @@ describe Lazier::Settings do
11
11
  let(:date_subject) { DateTime.civil(2005, 6, 7, 8, 9, 10, ::ActiveSupport::TimeZone.rationalize_offset(25200)) }
12
12
 
13
13
  before(:all) do
14
- Lazier.load!
14
+ Lazier.load!(:object)
15
15
  end
16
16
 
17
17
  describe ".instance" do
@@ -12,7 +12,7 @@ describe Lazier::String do
12
12
  let(:amp_subject) { "abc òùà èé >" }
13
13
 
14
14
  before(:all) do
15
- ::Lazier.load!
15
+ ::Lazier.load!(:string)
16
16
  end
17
17
 
18
18
  describe "#remove_accents" do
@@ -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.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-01 00:00:00.000000000 Z
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: '2.1'
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: '2.1'
40
+ version: '3.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: oj
43
43
  requirement: !ruby/object:Gem::Requirement