rails_admin_settings 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/lib/rails_admin_settings/settings.rb +2 -1
- data/lib/rails_admin_settings/version.rb +1 -1
- data/spec/namespaced_spec.rb +17 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5f605b04f4719af3aeb116ba70b9f721f490810
|
4
|
+
data.tar.gz: 223080615fa189bb049fe8e57af1d52463d425eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c11a66f5062741e56a22f936bc749c8851ad1a488d40b91b5d234d09f8f2aaadbce49bf9ab30380931b66e11a2a90872b043ee7d763df1859c45a803dc757228
|
7
|
+
data.tar.gz: a8e9bf1c5e5f490a676b51f573313e9df023e0cfa774e1df05d1c95de32bc8c8f2cf6eb7e2f888be36fc6a03afabec3daf2240ec8d5164f8d4567499337e28dd
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -29,7 +29,8 @@ class Settings < BasicObject
|
|
29
29
|
@@mutex.synchronize do
|
30
30
|
@@namespaces[name] ||= ::RailsAdminSettings::Namespaced.new(name.to_s)
|
31
31
|
end
|
32
|
-
|
32
|
+
fallback = options.key?(:fallback) ? options[:fallback] : @@ns_fallback
|
33
|
+
::RailsAdminSettings::Fallback.new(@@namespaces[name], fallback)
|
33
34
|
end
|
34
35
|
|
35
36
|
def get_default_ns
|
data/spec/namespaced_spec.rb
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe 'Namespaced settings' do
|
6
|
+
before :each do
|
7
|
+
Settings.destroy_all!
|
8
|
+
end
|
9
|
+
|
6
10
|
it 'sets namespaced' do
|
7
11
|
Settings.ns(:other).test = 'test'
|
8
12
|
end
|
@@ -47,4 +51,17 @@ describe 'Namespaced settings' do
|
|
47
51
|
expect(Settings.get(:test, ns: 'hitfood').raw).to eq 'zzz'
|
48
52
|
expect(Settings.get(:test, ns: 'main').raw).to eq ''
|
49
53
|
end
|
54
|
+
|
55
|
+
it 'falls back to default ns' do
|
56
|
+
Settings.ns_default = 'main'
|
57
|
+
Settings.ns_fallback = 'main'
|
58
|
+
|
59
|
+
Settings.ns(:main).test = 'main'
|
60
|
+
Settings.ns(:other).test = 'other'
|
61
|
+
|
62
|
+
expect(Settings.ns('main').test).to eq 'main'
|
63
|
+
expect(Settings.ns('other').test).to eq 'other'
|
64
|
+
expect(Settings.ns('other1').test).to eq 'main'
|
65
|
+
expect(Settings.ns('other2', fallback: nil).test).to eq ''
|
66
|
+
end
|
50
67
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_admin_settings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gleb Tv
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11
|
11
|
+
date: 2014-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|