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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aa83b47d1ef17ea8e1be39c4c404b6e49acbe0cb
4
- data.tar.gz: 53230a96ed135f093facbc06500e94be5a43352e
3
+ metadata.gz: a5f605b04f4719af3aeb116ba70b9f721f490810
4
+ data.tar.gz: 223080615fa189bb049fe8e57af1d52463d425eb
5
5
  SHA512:
6
- metadata.gz: 5faf380f5530eda01f3074d4811a96665d415bb135969254b323b17fa95f2856940422dfecbf7669640babb0fc4fec2126c69ef6890d130e8df6fdd85e3deaa0
7
- data.tar.gz: 47926c0c598dc0c764119524a191e57c4f98d0bbc7bd413c941b60038ca8048d40292d58865884e719d97d7705a98d9ce94a2c93d451a2ef89a9c125cb7fa0bc
6
+ metadata.gz: c11a66f5062741e56a22f936bc749c8851ad1a488d40b91b5d234d09f8f2aaadbce49bf9ab30380931b66e11a2a90872b043ee7d763df1859c45a803dc757228
7
+ data.tar.gz: a8e9bf1c5e5f490a676b51f573313e9df023e0cfa774e1df05d1c95de32bc8c8f2cf6eb7e2f888be36fc6a03afabec3daf2240ec8d5164f8d4567499337e28dd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.9.1
2
+
3
+ Settings.ns(ns) now defaults to fallback to Settings.ns_fallback
4
+ If you want an NS without fallback, specify nil:
5
+ Settings.ns(ns, fallback: nil)
6
+
1
7
  ## 0.9.0
2
8
 
3
9
  - Added ActiveRecord support
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_admin_settings (0.9.0)
4
+ rails_admin_settings (0.9.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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
- ::RailsAdminSettings::Fallback.new(@@namespaces[name], options[:fallback])
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
@@ -1,4 +1,4 @@
1
1
  module RailsAdminSettings
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
4
4
 
@@ -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.0
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-28 00:00:00.000000000 Z
11
+ date: 2014-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid