releaf-i18n_database 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a2285b84bfd3a4c1f9f3caf9a469d6084ff0a76
4
- data.tar.gz: ff736a57cb71be2961465c51fe0dba898ca9825d
3
+ metadata.gz: aba07692990a73c4d506094d544e388dc4eadf78
4
+ data.tar.gz: 31efe421e396cf876e74b3dc32ec2a8beebfa866
5
5
  SHA512:
6
- metadata.gz: dd1bfbd652e75750760eabb7dd0314fd68b1ba1b86ca3e527ae25899b24bd9d3a4e3c19f2537e92a1a8c6ce626b66116ed442c2c41e9f0870af9f7671d0ef599
7
- data.tar.gz: 676a0b51610fb443d8d57ceae4c2e46ff8323b3103f9b48b901524de34da45b61801a05123fae50bed9f5cd01e1b7450d6a42661afb9ce51de75aa8fcb5de89d
6
+ metadata.gz: 81b9f34b47e55f0babbe104ebf47b74afd8245608a9054efdeac3e011c4103a87f9fa6b06b54759e873cd3f4ea9032cab73290f26675959757efd7ac4a3e44d7
7
+ data.tar.gz: 233fb4145d4ce45acd3e53f16ed5c5649475525f3a958ff199d620e94ea1b67579eace23af5e63386850be262899aeaaa5856abc4265b3614c03cc5561011316
@@ -88,6 +88,11 @@ module Releaf
88
88
  translations.missing(locale, key, options) if result.nil?
89
89
 
90
90
  result
91
+ # As localization can be used in routes and as routes is loaded also when running `rake db:create`
92
+ # we want to supress those errors and silently return nil as developer/user will get database errors
93
+ # anyway when call to models will be made (let others do this)
94
+ rescue ActiveRecord::NoDatabaseError, ActiveRecord::StatementInvalid
95
+ nil
91
96
  end
92
97
  end
93
98
  end
@@ -188,5 +188,19 @@ describe Releaf::I18nDatabase::Backend do
188
188
  end
189
189
  end
190
190
  end
191
+
192
+ context "when database doesn't exists" do
193
+ it "returns an empty array" do
194
+ allow(Releaf::I18nDatabase::I18nEntry).to receive(:pluck).and_raise(ActiveRecord::NoDatabaseError.new("xxx"))
195
+ expect(subject.lookup(:lv, "some.localization", "_scope_", separator: ":", a: "b")).to be nil
196
+ end
197
+ end
198
+
199
+ context "when node table doesn't exist" do
200
+ it "returns an empty array" do
201
+ allow(Releaf::I18nDatabase::I18nEntry).to receive(:pluck).and_raise(ActiveRecord::StatementInvalid.new("xxx"))
202
+ expect(subject.lookup(:lv, "some.localization", "_scope_", separator: ":", a: "b")).to be nil
203
+ end
204
+ end
191
205
  end
192
206
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: releaf-i18n_database
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - CubeSystems
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-06 00:00:00.000000000 Z
11
+ date: 2016-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: releaf-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.5
19
+ version: 1.0.6
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.5
26
+ version: 1.0.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: twitter_cldr
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  version: '0'
140
140
  requirements: []
141
141
  rubyforge_project:
142
- rubygems_version: 2.6.7
142
+ rubygems_version: 2.5.1
143
143
  signing_key:
144
144
  specification_version: 4
145
145
  summary: i18n database gem for releaf