lazier 2.5.2 → 2.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -1
- data/doc/Lazier.html +1 -1
- data/doc/Lazier/Boolean.html +1 -1
- data/doc/Lazier/DateTime.html +1 -1
- data/doc/Lazier/DateTime/ClassMethods.html +1 -1
- data/doc/Lazier/Exceptions.html +2 -2
- data/doc/Lazier/Exceptions/Dump.html +1 -1
- data/doc/Lazier/Hash.html +1 -1
- data/doc/Lazier/I18n.html +1 -1
- data/doc/Lazier/Math.html +1 -1
- data/doc/Lazier/Math/ClassMethods.html +1 -1
- data/doc/Lazier/Object.html +1 -1
- data/doc/Lazier/Pathname.html +1 -1
- data/doc/Lazier/Settings.html +1 -1
- data/doc/Lazier/String.html +1 -1
- data/doc/Lazier/TimeZone.html +1 -1
- data/doc/Lazier/TimeZone/ClassMethods.html +1 -1
- data/doc/Lazier/Version.html +2 -2
- data/doc/_index.html +12 -5
- data/doc/class_list.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/lib/lazier/exceptions.rb +4 -0
- data/lib/lazier/i18n.rb +11 -1
- data/lib/lazier/version.rb +1 -1
- data/spec/lazier/i18n_spec.rb +24 -7
- metadata +2 -2
data/.travis.yml
CHANGED
data/doc/Lazier.html
CHANGED
@@ -838,7 +838,7 @@ Licensed under the MIT license, which can be found at <a href="http://www.openso
|
|
838
838
|
</div>
|
839
839
|
|
840
840
|
<div id="footer">
|
841
|
-
Generated on
|
841
|
+
Generated on Sun Feb 3 17:17:48 2013 by
|
842
842
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
843
843
|
0.8.3 (ruby-1.9.3).
|
844
844
|
</div>
|
data/doc/Lazier/Boolean.html
CHANGED
@@ -288,7 +288,7 @@
|
|
288
288
|
</div>
|
289
289
|
|
290
290
|
<div id="footer">
|
291
|
-
Generated on
|
291
|
+
Generated on Sun Feb 3 17:17:48 2013 by
|
292
292
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
293
293
|
0.8.3 (ruby-1.9.3).
|
294
294
|
</div>
|
data/doc/Lazier/DateTime.html
CHANGED
@@ -724,7 +724,7 @@
|
|
724
724
|
</div>
|
725
725
|
|
726
726
|
<div id="footer">
|
727
|
-
Generated on
|
727
|
+
Generated on Sun Feb 3 17:17:48 2013 by
|
728
728
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
729
729
|
0.8.3 (ruby-1.9.3).
|
730
730
|
</div>
|
@@ -1565,7 +1565,7 @@
|
|
1565
1565
|
</div>
|
1566
1566
|
|
1567
1567
|
<div id="footer">
|
1568
|
-
Generated on
|
1568
|
+
Generated on Sun Feb 3 17:17:48 2013 by
|
1569
1569
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1570
1570
|
0.8.3 (ruby-1.9.3).
|
1571
1571
|
</div>
|
data/doc/Lazier/Exceptions.html
CHANGED
@@ -100,7 +100,7 @@
|
|
100
100
|
|
101
101
|
|
102
102
|
|
103
|
-
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Exceptions/Dump.html" title="Lazier::Exceptions::Dump (class)">Dump</a></span>
|
103
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Exceptions/Dump.html" title="Lazier::Exceptions::Dump (class)">Dump</a></span>, <span class='object_link'><a href="Exceptions/MissingTranslation.html" title="Lazier::Exceptions::MissingTranslation (class)">MissingTranslation</a></span>
|
104
104
|
|
105
105
|
|
106
106
|
</p>
|
@@ -116,7 +116,7 @@
|
|
116
116
|
</div>
|
117
117
|
|
118
118
|
<div id="footer">
|
119
|
-
Generated on
|
119
|
+
Generated on Sun Feb 3 17:17:48 2013 by
|
120
120
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
121
121
|
0.8.3 (ruby-1.9.3).
|
122
122
|
</div>
|
@@ -124,7 +124,7 @@
|
|
124
124
|
</div>
|
125
125
|
|
126
126
|
<div id="footer">
|
127
|
-
Generated on
|
127
|
+
Generated on Sun Feb 3 17:17:49 2013 by
|
128
128
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
129
129
|
0.8.3 (ruby-1.9.3).
|
130
130
|
</div>
|
data/doc/Lazier/Hash.html
CHANGED
@@ -384,7 +384,7 @@
|
|
384
384
|
</div>
|
385
385
|
|
386
386
|
<div id="footer">
|
387
|
-
Generated on
|
387
|
+
Generated on Sun Feb 3 17:17:48 2013 by
|
388
388
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
389
389
|
0.8.3 (ruby-1.9.3).
|
390
390
|
</div>
|
data/doc/Lazier/I18n.html
CHANGED
@@ -405,7 +405,7 @@
|
|
405
405
|
</div>
|
406
406
|
|
407
407
|
<div id="footer">
|
408
|
-
Generated on
|
408
|
+
Generated on Sun Feb 3 17:17:48 2013 by
|
409
409
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
410
410
|
0.8.3 (ruby-1.9.3).
|
411
411
|
</div>
|
data/doc/Lazier/Math.html
CHANGED
@@ -121,7 +121,7 @@
|
|
121
121
|
</div>
|
122
122
|
|
123
123
|
<div id="footer">
|
124
|
-
Generated on
|
124
|
+
Generated on Sun Feb 3 17:17:48 2013 by
|
125
125
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
126
126
|
0.8.3 (ruby-1.9.3).
|
127
127
|
</div>
|
@@ -321,7 +321,7 @@
|
|
321
321
|
</div>
|
322
322
|
|
323
323
|
<div id="footer">
|
324
|
-
Generated on
|
324
|
+
Generated on Sun Feb 3 17:17:48 2013 by
|
325
325
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
326
326
|
0.8.3 (ruby-1.9.3).
|
327
327
|
</div>
|
data/doc/Lazier/Object.html
CHANGED
@@ -1586,7 +1586,7 @@
|
|
1586
1586
|
</div>
|
1587
1587
|
|
1588
1588
|
<div id="footer">
|
1589
|
-
Generated on
|
1589
|
+
Generated on Sun Feb 3 17:17:48 2013 by
|
1590
1590
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1591
1591
|
0.8.3 (ruby-1.9.3).
|
1592
1592
|
</div>
|
data/doc/Lazier/Pathname.html
CHANGED
@@ -216,7 +216,7 @@
|
|
216
216
|
</div>
|
217
217
|
|
218
218
|
<div id="footer">
|
219
|
-
Generated on
|
219
|
+
Generated on Sun Feb 3 17:17:48 2013 by
|
220
220
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
221
221
|
0.8.3 (ruby-1.9.3).
|
222
222
|
</div>
|
data/doc/Lazier/Settings.html
CHANGED
@@ -2496,7 +2496,7 @@
|
|
2496
2496
|
</div>
|
2497
2497
|
|
2498
2498
|
<div id="footer">
|
2499
|
-
Generated on
|
2499
|
+
Generated on Sun Feb 3 17:17:49 2013 by
|
2500
2500
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2501
2501
|
0.8.3 (ruby-1.9.3).
|
2502
2502
|
</div>
|
data/doc/Lazier/String.html
CHANGED
@@ -462,7 +462,7 @@
|
|
462
462
|
</div>
|
463
463
|
|
464
464
|
<div id="footer">
|
465
|
-
Generated on
|
465
|
+
Generated on Sun Feb 3 17:17:48 2013 by
|
466
466
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
467
467
|
0.8.3 (ruby-1.9.3).
|
468
468
|
</div>
|
data/doc/Lazier/TimeZone.html
CHANGED
@@ -1697,7 +1697,7 @@
|
|
1697
1697
|
</div>
|
1698
1698
|
|
1699
1699
|
<div id="footer">
|
1700
|
-
Generated on
|
1700
|
+
Generated on Sun Feb 3 17:17:48 2013 by
|
1701
1701
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1702
1702
|
0.8.3 (ruby-1.9.3).
|
1703
1703
|
</div>
|
@@ -1022,7 +1022,7 @@
|
|
1022
1022
|
</div>
|
1023
1023
|
|
1024
1024
|
<div id="footer">
|
1025
|
-
Generated on
|
1025
|
+
Generated on Sun Feb 3 17:17:48 2013 by
|
1026
1026
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1027
1027
|
0.8.3 (ruby-1.9.3).
|
1028
1028
|
</div>
|
data/doc/Lazier/Version.html
CHANGED
@@ -149,7 +149,7 @@
|
|
149
149
|
|
150
150
|
</div>
|
151
151
|
</dt>
|
152
|
-
<dd><pre class="code"><span class='int'>
|
152
|
+
<dd><pre class="code"><span class='int'>3</span></pre></dd>
|
153
153
|
|
154
154
|
<dt id="STRING-constant" class="">STRING =
|
155
155
|
<div class="docstring">
|
@@ -180,7 +180,7 @@
|
|
180
180
|
</div>
|
181
181
|
|
182
182
|
<div id="footer">
|
183
|
-
Generated on
|
183
|
+
Generated on Sun Feb 3 17:17:48 2013 by
|
184
184
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
185
185
|
0.8.3 (ruby-1.9.3).
|
186
186
|
</div>
|
data/doc/_index.html
CHANGED
@@ -100,9 +100,9 @@
|
|
100
100
|
<ul>
|
101
101
|
|
102
102
|
<li>
|
103
|
-
<span class='object_link'><a href="Lazier/
|
103
|
+
<span class='object_link'><a href="Lazier/TimeZone/ClassMethods.html" title="Lazier::TimeZone::ClassMethods (module)">ClassMethods</a></span>
|
104
104
|
|
105
|
-
<small>(Lazier::
|
105
|
+
<small>(Lazier::TimeZone)</small>
|
106
106
|
|
107
107
|
</li>
|
108
108
|
|
@@ -114,9 +114,9 @@
|
|
114
114
|
</li>
|
115
115
|
|
116
116
|
<li>
|
117
|
-
<span class='object_link'><a href="Lazier/
|
117
|
+
<span class='object_link'><a href="Lazier/Math/ClassMethods.html" title="Lazier::Math::ClassMethods (module)">ClassMethods</a></span>
|
118
118
|
|
119
|
-
<small>(Lazier::
|
119
|
+
<small>(Lazier::Math)</small>
|
120
120
|
|
121
121
|
</li>
|
122
122
|
|
@@ -218,6 +218,13 @@
|
|
218
218
|
|
219
219
|
</li>
|
220
220
|
|
221
|
+
<li>
|
222
|
+
<span class='object_link'><a href="Lazier/Exceptions/MissingTranslation.html" title="Lazier::Exceptions::MissingTranslation (class)">MissingTranslation</a></span>
|
223
|
+
|
224
|
+
<small>(Lazier::Exceptions)</small>
|
225
|
+
|
226
|
+
</li>
|
227
|
+
|
221
228
|
</ul>
|
222
229
|
</ul>
|
223
230
|
|
@@ -312,7 +319,7 @@
|
|
312
319
|
</div>
|
313
320
|
|
314
321
|
<div id="footer">
|
315
|
-
Generated on
|
322
|
+
Generated on Sun Feb 3 17:17:48 2013 by
|
316
323
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
317
324
|
0.8.3 (ruby-1.9.3).
|
318
325
|
</div>
|
data/doc/class_list.html
CHANGED
@@ -45,7 +45,7 @@
|
|
45
45
|
|
46
46
|
<ul id="full_list" class="class">
|
47
47
|
<li><span class='object_link'><a href="top-level-namespace.html" title=" (root)">Top Level Namespace</a></span></li>
|
48
|
-
<li><a class='toggle'></a> <span class='object_link'><a href="Lazier.html" title="Lazier (module)">Lazier</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><span class='object_link'><a href="Lazier/Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span><small class='search_info'>Lazier</small></li><li><a class='toggle'></a> <span class='object_link'><a href="Lazier/DateTime.html" title="Lazier::DateTime (module)">DateTime</a></span><small class='search_info'>Lazier</small></li><ul><li><span class='object_link'><a href="Lazier/DateTime/ClassMethods.html" title="Lazier::DateTime::ClassMethods (module)">ClassMethods</a></span><small class='search_info'>Lazier::DateTime</small></li></ul><li><a class='toggle'></a> <span class='object_link'><a href="Lazier/Exceptions.html" title="Lazier::Exceptions (module)">Exceptions</a></span><small class='search_info'>Lazier</small></li><ul><li><span class='object_link'><a href="Lazier/Exceptions/Dump.html" title="Lazier::Exceptions::Dump (class)">Dump</a></span> < RuntimeError<small class='search_info'>Lazier::Exceptions</small></li></ul><li><span class='object_link'><a href="Lazier/Hash.html" title="Lazier::Hash (module)">Hash</a></span><small class='search_info'>Lazier</small></li><li><span class='object_link'><a href="Lazier/I18n.html" title="Lazier::I18n (module)">I18n</a></span><small class='search_info'>Lazier</small></li><li><a class='toggle'></a> <span class='object_link'><a href="Lazier/Math.html" title="Lazier::Math (module)">Math</a></span><small class='search_info'>Lazier</small></li><ul><li><span class='object_link'><a href="Lazier/Math/ClassMethods.html" title="Lazier::Math::ClassMethods (module)">ClassMethods</a></span><small class='search_info'>Lazier::Math</small></li></ul><li><span class='object_link'><a href="Lazier/Object.html" title="Lazier::Object (module)">Object</a></span><small class='search_info'>Lazier</small></li><li><span class='object_link'><a href="Lazier/Pathname.html" title="Lazier::Pathname (module)">Pathname</a></span><small class='search_info'>Lazier</small></li><li><span class='object_link'><a href="Lazier/Settings.html" title="Lazier::Settings (class)">Settings</a></span> < Object<small class='search_info'>Lazier</small></li><li><span class='object_link'><a href="Lazier/String.html" title="Lazier::String (module)">String</a></span><small class='search_info'>Lazier</small></li><li><a class='toggle'></a> <span class='object_link'><a href="Lazier/TimeZone.html" title="Lazier::TimeZone (module)">TimeZone</a></span><small class='search_info'>Lazier</small></li><ul><li><span class='object_link'><a href="Lazier/TimeZone/ClassMethods.html" title="Lazier::TimeZone::ClassMethods (module)">ClassMethods</a></span><small class='search_info'>Lazier::TimeZone</small></li></ul><li><span class='object_link'><a href="Lazier/Version.html" title="Lazier::Version (module)">Version</a></span><small class='search_info'>Lazier</small></li></ul>
|
48
|
+
<li><a class='toggle'></a> <span class='object_link'><a href="Lazier.html" title="Lazier (module)">Lazier</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><span class='object_link'><a href="Lazier/Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span><small class='search_info'>Lazier</small></li><li><a class='toggle'></a> <span class='object_link'><a href="Lazier/DateTime.html" title="Lazier::DateTime (module)">DateTime</a></span><small class='search_info'>Lazier</small></li><ul><li><span class='object_link'><a href="Lazier/DateTime/ClassMethods.html" title="Lazier::DateTime::ClassMethods (module)">ClassMethods</a></span><small class='search_info'>Lazier::DateTime</small></li></ul><li><a class='toggle'></a> <span class='object_link'><a href="Lazier/Exceptions.html" title="Lazier::Exceptions (module)">Exceptions</a></span><small class='search_info'>Lazier</small></li><ul><li><span class='object_link'><a href="Lazier/Exceptions/Dump.html" title="Lazier::Exceptions::Dump (class)">Dump</a></span> < RuntimeError<small class='search_info'>Lazier::Exceptions</small></li><li><span class='object_link'><a href="Lazier/Exceptions/MissingTranslation.html" title="Lazier::Exceptions::MissingTranslation (class)">MissingTranslation</a></span> < Exception<small class='search_info'>Lazier::Exceptions</small></li></ul><li><span class='object_link'><a href="Lazier/Hash.html" title="Lazier::Hash (module)">Hash</a></span><small class='search_info'>Lazier</small></li><li><span class='object_link'><a href="Lazier/I18n.html" title="Lazier::I18n (module)">I18n</a></span><small class='search_info'>Lazier</small></li><li><a class='toggle'></a> <span class='object_link'><a href="Lazier/Math.html" title="Lazier::Math (module)">Math</a></span><small class='search_info'>Lazier</small></li><ul><li><span class='object_link'><a href="Lazier/Math/ClassMethods.html" title="Lazier::Math::ClassMethods (module)">ClassMethods</a></span><small class='search_info'>Lazier::Math</small></li></ul><li><span class='object_link'><a href="Lazier/Object.html" title="Lazier::Object (module)">Object</a></span><small class='search_info'>Lazier</small></li><li><span class='object_link'><a href="Lazier/Pathname.html" title="Lazier::Pathname (module)">Pathname</a></span><small class='search_info'>Lazier</small></li><li><span class='object_link'><a href="Lazier/Settings.html" title="Lazier::Settings (class)">Settings</a></span> < Object<small class='search_info'>Lazier</small></li><li><span class='object_link'><a href="Lazier/String.html" title="Lazier::String (module)">String</a></span><small class='search_info'>Lazier</small></li><li><a class='toggle'></a> <span class='object_link'><a href="Lazier/TimeZone.html" title="Lazier::TimeZone (module)">TimeZone</a></span><small class='search_info'>Lazier</small></li><ul><li><span class='object_link'><a href="Lazier/TimeZone/ClassMethods.html" title="Lazier::TimeZone::ClassMethods (module)">ClassMethods</a></span><small class='search_info'>Lazier::TimeZone</small></li></ul><li><span class='object_link'><a href="Lazier/Version.html" title="Lazier::Version (module)">Version</a></span><small class='search_info'>Lazier</small></li></ul>
|
49
49
|
|
50
50
|
</ul>
|
51
51
|
</div>
|
data/doc/file.README.html
CHANGED
@@ -102,7 +102,7 @@ See documentation for more informations.</p>
|
|
102
102
|
</div></div>
|
103
103
|
|
104
104
|
<div id="footer">
|
105
|
-
Generated on
|
105
|
+
Generated on Sun Feb 3 17:17:48 2013 by
|
106
106
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
107
107
|
0.8.3 (ruby-1.9.3).
|
108
108
|
</div>
|
data/doc/index.html
CHANGED
@@ -102,7 +102,7 @@ See documentation for more informations.</p>
|
|
102
102
|
</div></div>
|
103
103
|
|
104
104
|
<div id="footer">
|
105
|
-
Generated on
|
105
|
+
Generated on Sun Feb 3 17:17:48 2013 by
|
106
106
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
107
107
|
0.8.3 (ruby-1.9.3).
|
108
108
|
</div>
|
@@ -103,7 +103,7 @@
|
|
103
103
|
</div>
|
104
104
|
|
105
105
|
<div id="footer">
|
106
|
-
Generated on
|
106
|
+
Generated on Sun Feb 3 17:17:48 2013 by
|
107
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
108
|
0.8.3 (ruby-1.9.3).
|
109
109
|
</div>
|
data/lib/lazier/exceptions.rb
CHANGED
@@ -10,5 +10,9 @@ module Lazier
|
|
10
10
|
# This exception is raised from {Object#debug_dump} when `must_raise` is `true`.
|
11
11
|
class Dump < ::RuntimeError
|
12
12
|
end
|
13
|
+
|
14
|
+
# This exception is raised from {I18n I18n} if no valid translation are found in the specified path.
|
15
|
+
class MissingTranslation < Exception
|
16
|
+
end
|
13
17
|
end
|
14
18
|
end
|
data/lib/lazier/i18n.rb
CHANGED
@@ -37,7 +37,17 @@ module Lazier
|
|
37
37
|
# @param locale [Symbol] The new locale. Default is the current system locale.
|
38
38
|
# @return [R18n::Translation] The new translation object.
|
39
39
|
def i18n_load_locale(locale)
|
40
|
-
|
40
|
+
path = (@i18n_locales_path || "").to_s
|
41
|
+
locales = [locale, ENV["LANG"], R18n::I18n.system_locale].select { |l| File.exists?("#{path}/#{l}.yml") }.uniq.compact
|
42
|
+
|
43
|
+
begin
|
44
|
+
raise Lazier::Exceptions::MissingTranslation if locales.blank?
|
45
|
+
translation = R18n::I18n.new(locales, path)
|
46
|
+
raise Lazier::Exceptions::MissingTranslation if !translation
|
47
|
+
translation.t.send((@i18n_root || "").to_s)
|
48
|
+
rescue Lazier::Exceptions::MissingTranslation => e
|
49
|
+
raise e
|
50
|
+
end
|
41
51
|
end
|
42
52
|
end
|
43
53
|
end
|
data/lib/lazier/version.rb
CHANGED
data/spec/lazier/i18n_spec.rb
CHANGED
@@ -12,12 +12,16 @@ end
|
|
12
12
|
|
13
13
|
describe Lazier::I18n do
|
14
14
|
let(:object) { Container.new }
|
15
|
+
let(:root_path) { ::File.absolute_path(::Pathname.new(::File.dirname(__FILE__)).to_s + "/../../locales/") }
|
16
|
+
before(:each) do
|
17
|
+
ENV["LANG"] = "en"
|
18
|
+
end
|
15
19
|
|
16
20
|
describe "#i18n_setup" do
|
17
21
|
it "should set the root and the path" do
|
18
|
-
object.i18n_setup("ROOT",
|
22
|
+
object.i18n_setup("ROOT", root_path)
|
19
23
|
expect(object.instance_variable_get(:@i18n_root)).to eq(:ROOT)
|
20
|
-
expect(object.instance_variable_get(:@i18n_locales_path)).to eq(
|
24
|
+
expect(object.instance_variable_get(:@i18n_locales_path)).to eq(root_path)
|
21
25
|
end
|
22
26
|
end
|
23
27
|
|
@@ -40,24 +44,37 @@ describe Lazier::I18n do
|
|
40
44
|
|
41
45
|
describe "#i18n_load_locale" do
|
42
46
|
it "should set using system locale if called without arguments" do
|
43
|
-
object.i18n_setup("ROOT",
|
44
|
-
R18n::I18n.should_receive(:new).with([ENV["LANG"], R18n::I18n.system_locale].compact,
|
47
|
+
object.i18n_setup("ROOT", root_path)
|
48
|
+
R18n::I18n.should_receive(:new).with([ENV["LANG"], R18n::I18n.system_locale].compact, root_path).and_call_original
|
45
49
|
object.i18n = nil
|
46
50
|
end
|
47
51
|
|
48
52
|
it "should set the requested locale" do
|
49
|
-
object.i18n_setup("ROOT",
|
50
|
-
R18n::I18n.should_receive(:new).with([:it, ENV["LANG"], R18n::I18n.system_locale].compact,
|
53
|
+
object.i18n_setup("ROOT", root_path)
|
54
|
+
R18n::I18n.should_receive(:new).with([:it, ENV["LANG"], R18n::I18n.system_locale].compact, root_path).and_call_original
|
51
55
|
object.i18n = :it
|
52
56
|
end
|
53
57
|
|
54
58
|
it "should call the root" do
|
55
59
|
Lazier.load!
|
56
60
|
t = Object.new
|
57
|
-
object.i18n_setup("ROOT",
|
61
|
+
object.i18n_setup("ROOT", root_path)
|
58
62
|
R18n::I18n.any_instance.should_receive(:t).and_return(t)
|
59
63
|
t.should_receive("ROOT")
|
60
64
|
object.i18n = :it
|
61
65
|
end
|
66
|
+
|
67
|
+
it "should only pass valid translations" do
|
68
|
+
object.i18n_setup("ROOT", root_path)
|
69
|
+
R18n::I18n.should_receive(:new).with([ENV["LANG"], R18n::I18n.system_locale].compact, root_path).and_call_original
|
70
|
+
object.i18n = "INVALID"
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should raise an exception if no valid translation are found" do
|
74
|
+
ENV["LANG"] = "INVALID"
|
75
|
+
R18n::I18n.stub(:system_locale).and_return("INVALID")
|
76
|
+
object.i18n_setup("ROOT", root_path)
|
77
|
+
expect { object.i18n = "INVALID" }.to raise_error(Lazier::Exceptions::MissingTranslation)
|
78
|
+
end
|
62
79
|
end
|
63
80
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lazier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|