squire 1.2.6 → 1.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -13
- data/lib/squire/settings.rb +1 -0
- data/lib/squire/version.rb +1 -1
- data/spec/spec_helper.rb +4 -0
- data/spec/squire/base_spec.rb +10 -10
- data/spec/squire/configuration_spec.rb +30 -30
- data/spec/squire/core_ext/hash/deep_merge_spec.rb +4 -4
- data/spec/squire/parser/hash_spec.rb +2 -2
- data/spec/squire/parser/yaml_spec.rb +2 -2
- data/spec/squire/proxy_spec.rb +11 -11
- data/spec/squire/settings_spec.rb +41 -29
- metadata +13 -13
    
        checksums.yaml
    CHANGED
    
    | @@ -1,15 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 | 
            -
             | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
             | 
| 5 | 
            -
              data.tar.gz: !binary |-
         | 
| 6 | 
            -
                NTZjNmZiM2JjNTY1ZjhjNmI2ZGE2YWRjZDllMjQyMjlhYzlmM2QwMg==
         | 
| 2 | 
            +
            SHA1:
         | 
| 3 | 
            +
              metadata.gz: db2bb28316c8d01b055c02e29df0c7bd8b85c3fe
         | 
| 4 | 
            +
              data.tar.gz: da3ef166ef7889ae4efb019fcdc4a6dd8ec5e82e
         | 
| 7 5 | 
             
            SHA512:
         | 
| 8 | 
            -
              metadata.gz:  | 
| 9 | 
            -
             | 
| 10 | 
            -
                YTRkNjZkMTViZTQ3YWIyMzYxYzk4MmEzNGUwZTFhMTE3Y2MzNmUzOGQwYWYy
         | 
| 11 | 
            -
                YzNmZmE2Zjc3NDU5ZDU4ZjQ4YTBhMTczOTQ5M2ZmNGJmNWZiYWM=
         | 
| 12 | 
            -
              data.tar.gz: !binary |-
         | 
| 13 | 
            -
                MGQ4Nzg3Yjc3Yjc4MjFjOTBmZTg0ZTM2ZTVhZjk1NzkxNWE3NGM0NGM2Y2Zk
         | 
| 14 | 
            -
                MGMzMGMxMjg5Y2UwM2U5NmQ0NTQ2YzZkNjkzMjM2Nzk2ZTVhMDA1NThlNTI4
         | 
| 15 | 
            -
                OTlhNWNkYzA1YjBmNGUyNzRiZjcxNDUzNzM5OTdlOThlZDM2ODY=
         | 
| 6 | 
            +
              metadata.gz: 86160134e6339a2efc5b8d735194c88fc13dc0b94ea242027d742db4d8afb2420e07fba0b9da41e598f064f994bb660a8e5e19cba877b55c6bbf2c133cf7774a
         | 
| 7 | 
            +
              data.tar.gz: 90b34e2fcc12c5aa2b2235b90c6341b1d52d2db261fdfa9719c5c1bcb2e1d99fd8f8823350aafc6f2a96758aa6348afc2f336d8a6f2728e31ea7e67be9b121e9
         | 
    
        data/lib/squire/settings.rb
    CHANGED
    
    
    
        data/lib/squire/version.rb
    CHANGED
    
    
    
        data/spec/spec_helper.rb
    CHANGED
    
    
    
        data/spec/squire/base_spec.rb
    CHANGED
    
    | @@ -11,7 +11,7 @@ describe Squire::Base do | |
| 11 11 | 
             
                subject.squire.reload!
         | 
| 12 12 | 
             
              end
         | 
| 13 13 |  | 
| 14 | 
            -
              it ' | 
| 14 | 
            +
              it 'properly sets up base configuration' do
         | 
| 15 15 | 
             
                subject.squire.source    development: { a: 1, b: 2 }
         | 
| 16 16 | 
             
                subject.squire.namespace :development
         | 
| 17 17 |  | 
| @@ -19,23 +19,23 @@ describe Squire::Base do | |
| 19 19 | 
             
                  config.c = 3
         | 
| 20 20 | 
             
                end
         | 
| 21 21 |  | 
| 22 | 
            -
                subject.config.a. | 
| 23 | 
            -
                subject.config.b. | 
| 24 | 
            -
                subject.config.c. | 
| 22 | 
            +
                expect(subject.config.a).to eql(1)
         | 
| 23 | 
            +
                expect(subject.config.b).to  eql(2)
         | 
| 24 | 
            +
                expect(subject.config.c).to eql(3)
         | 
| 25 25 |  | 
| 26 | 
            -
                subject.a. | 
| 27 | 
            -
                subject.b. | 
| 28 | 
            -
                subject.c. | 
| 26 | 
            +
                expect(subject.a).to eql(1)
         | 
| 27 | 
            +
                expect(subject.b).to eql(2)
         | 
| 28 | 
            +
                expect(subject.c).to eql(3)
         | 
| 29 29 |  | 
| 30 30 | 
             
                expect { subject.d }.to raise_error(Squire::MissingSettingError)
         | 
| 31 31 | 
             
              end
         | 
| 32 32 |  | 
| 33 | 
            -
              it ' | 
| 33 | 
            +
              it 'properly delegates keys' do
         | 
| 34 34 | 
             
                subject.squire.source    test: { a: 1, b: 2 }
         | 
| 35 35 | 
             
                subject.squire.namespace :test
         | 
| 36 36 |  | 
| 37 | 
            -
                subject.a. | 
| 38 | 
            -
                subject.b. | 
| 37 | 
            +
                expect(subject.a).to eql(1)
         | 
| 38 | 
            +
                expect(subject.b).to eql(2)
         | 
| 39 39 |  | 
| 40 40 | 
             
                expect { subject.c }.to raise_error(Squire::MissingSettingError, /Missing setting 'c' in 'test'/)
         | 
| 41 41 | 
             
              end
         | 
| @@ -27,81 +27,81 @@ describe Squire::Configuration do | |
| 27 27 | 
             
              }
         | 
| 28 28 |  | 
| 29 29 | 
             
              describe '#source' do
         | 
| 30 | 
            -
                it ' | 
| 30 | 
            +
                it 'properly sets hash as source' do
         | 
| 31 31 | 
             
                  subject.source hash
         | 
| 32 32 |  | 
| 33 | 
            -
                  subject.source. | 
| 33 | 
            +
                  expect(subject.source).to eql(hash)
         | 
| 34 34 | 
             
                end
         | 
| 35 35 |  | 
| 36 | 
            -
                it ' | 
| 36 | 
            +
                it 'properly sets yaml sa a source' do
         | 
| 37 37 | 
             
                  subject.source 'config.yml'
         | 
| 38 38 |  | 
| 39 | 
            -
                  subject.source. | 
| 40 | 
            -
                  subject.type. | 
| 39 | 
            +
                  expect(subject.source).to eql('config.yml')
         | 
| 40 | 
            +
                  expect(subject.type).to   eql(:yml)
         | 
| 41 41 | 
             
                end
         | 
| 42 42 | 
             
              end
         | 
| 43 43 |  | 
| 44 44 | 
             
              describe '#namespace' do
         | 
| 45 | 
            -
                it ' | 
| 45 | 
            +
                it 'properly sets namespace' do
         | 
| 46 46 | 
             
                  subject.source    hash
         | 
| 47 47 | 
             
                  subject.namespace :development
         | 
| 48 48 |  | 
| 49 | 
            -
                  subject.settings.a. | 
| 50 | 
            -
                  subject.namespace. | 
| 49 | 
            +
                  expect(subject.settings.a).to eql(1)
         | 
| 50 | 
            +
                  expect(subject.namespace).to eql(:development)
         | 
| 51 51 |  | 
| 52 52 | 
             
                  expect { subject.settings.development }.to raise_exception(Squire::MissingSettingError)
         | 
| 53 53 | 
             
                end
         | 
| 54 54 |  | 
| 55 | 
            -
                it ' | 
| 55 | 
            +
                it 'properly handles runtime changing of namespaces' do
         | 
| 56 56 | 
             
                  subject.source    hash
         | 
| 57 57 | 
             
                  subject.namespace :development
         | 
| 58 58 |  | 
| 59 | 
            -
                  subject.settings.a. | 
| 59 | 
            +
                  expect(subject.settings.a).to eql(1)
         | 
| 60 60 |  | 
| 61 61 | 
             
                  subject.namespace :production
         | 
| 62 62 |  | 
| 63 | 
            -
                  subject.settings.a. | 
| 63 | 
            +
                  expect(subject.settings.a).to eql(3)
         | 
| 64 64 | 
             
                end
         | 
| 65 65 |  | 
| 66 | 
            -
                it ' | 
| 66 | 
            +
                it 'handles base namespace overriding' do
         | 
| 67 67 | 
             
                  subject.source    hash
         | 
| 68 68 | 
             
                  subject.namespace :development, base: :defaults
         | 
| 69 69 |  | 
| 70 | 
            -
                  subject.settings.a. | 
| 71 | 
            -
                  subject.settings.nested.b. | 
| 72 | 
            -
                  subject.settings.nested.d. | 
| 73 | 
            -
                  subject.settings.nested.c. | 
| 70 | 
            +
                  expect(subject.settings.a).to        eql(1)
         | 
| 71 | 
            +
                  expect(subject.settings.nested.b).to eql(2) # from development.nested.b
         | 
| 72 | 
            +
                  expect(subject.settings.nested.d).to be_false # from development.nested.d
         | 
| 73 | 
            +
                  expect(subject.settings.nested.c).to eql(4) # from defaults.nested.c
         | 
| 74 74 |  | 
| 75 75 | 
             
                  subject.source    hash
         | 
| 76 76 | 
             
                  subject.namespace :production, base: :defaults
         | 
| 77 77 |  | 
| 78 | 
            -
                  subject.settings.a. | 
| 79 | 
            -
                  subject.settings.nested.b. | 
| 80 | 
            -
                  subject.settings.nested.d. | 
| 78 | 
            +
                  expect(subject.settings.a).to        eql(3)
         | 
| 79 | 
            +
                  expect(subject.settings.nested.b).to eql(4) # from development.nested.b
         | 
| 80 | 
            +
                  expect(subject.settings.nested.d).to be_true # from development.nested.d
         | 
| 81 81 | 
             
                end
         | 
| 82 82 | 
             
              end
         | 
| 83 83 |  | 
| 84 84 | 
             
              describe '#setup' do
         | 
| 85 | 
            -
                let(:path) | 
| 85 | 
            +
                let(:path)    { '/path/to/file.yml'}
         | 
| 86 86 | 
             
                let(:factory) { double(:factory) }
         | 
| 87 87 | 
             
                let(:parser)  { double(:parser) }
         | 
| 88 88 |  | 
| 89 | 
            -
                it ' | 
| 89 | 
            +
                it 'sets up basic settings from hash' do
         | 
| 90 90 | 
             
                  subject.source(hash)
         | 
| 91 91 |  | 
| 92 | 
            -
                  factory. | 
| 93 | 
            -
                  parser. | 
| 92 | 
            +
                  expect(factory).to receive(:of).with(:hash).and_return(parser)
         | 
| 93 | 
            +
                  expect(parser).to receive(:parse).with(hash).and_return(hash)
         | 
| 94 94 |  | 
| 95 95 | 
             
                  stub_const('Squire::Parser', factory)
         | 
| 96 96 |  | 
| 97 97 | 
             
                  settings = subject.setup
         | 
| 98 98 |  | 
| 99 | 
            -
                  settings.to_hash. | 
| 99 | 
            +
                  expect(settings.to_hash).to eql(hash)
         | 
| 100 100 | 
             
                end
         | 
| 101 101 |  | 
| 102 | 
            -
                it ' | 
| 103 | 
            -
                  factory. | 
| 104 | 
            -
                  parser. | 
| 102 | 
            +
                it 'sets up basic settings yml' do
         | 
| 103 | 
            +
                  expect(factory).to receive(:of).with(:yml).and_return(parser)
         | 
| 104 | 
            +
                  expect(parser).to receive(:parse).with(path).and_return(hash)
         | 
| 105 105 |  | 
| 106 106 | 
             
                  stub_const('Squire::Parser', factory)
         | 
| 107 107 |  | 
| @@ -109,11 +109,11 @@ describe Squire::Configuration do | |
| 109 109 |  | 
| 110 110 | 
             
                  settings = subject.settings
         | 
| 111 111 |  | 
| 112 | 
            -
                  settings.development.a. | 
| 113 | 
            -
                  settings.development.nested.b. | 
| 112 | 
            +
                  expect(settings.development.a).to        eql(1)
         | 
| 113 | 
            +
                  expect(settings.development.nested.b).to eql(2)
         | 
| 114 114 | 
             
                end
         | 
| 115 115 |  | 
| 116 | 
            -
                it ' | 
| 116 | 
            +
                it 'does not set up source with unknown filetype' do
         | 
| 117 117 | 
             
                  subject.source(path, type: :bogus)
         | 
| 118 118 |  | 
| 119 119 | 
             
                  expect { subject.setup }.to raise_error Squire::UndefinedParserError
         | 
| @@ -5,16 +5,16 @@ describe Hash do | |
| 5 5 | 
             
                let(:a) {{ a: 1, b: 2, c: 3, nested: { a: 1 }}}
         | 
| 6 6 | 
             
                let(:b) {{ a: 1, c: 3, d: 4, nested: { a: 2, b: 3 }}}
         | 
| 7 7 |  | 
| 8 | 
            -
                it ' | 
| 8 | 
            +
                it 'merges hashes deeply' do
         | 
| 9 9 | 
             
                  merge = { a: 1, b: 2, c: 3, d: 4, nested: { a: 2, b: 3 }}
         | 
| 10 10 |  | 
| 11 | 
            -
                  a.deep_merge(b). | 
| 11 | 
            +
                  expect(a.deep_merge(b)).to eql(merge)
         | 
| 12 12 | 
             
                end
         | 
| 13 13 |  | 
| 14 | 
            -
                it ' | 
| 14 | 
            +
                it 'merges hashes deeply with block' do
         | 
| 15 15 | 
             
                  merge = { a: [:a, 1, 1], b: 2, c: [:c, 3, 3], d: [:d, nil, 4], nested: { a: [:a, 1, 2], b: [:b, nil, 3] }}
         | 
| 16 16 |  | 
| 17 | 
            -
                  (a.deep_merge(b) { |key, old, new| [key, old, new] }). | 
| 17 | 
            +
                  expect(a.deep_merge(b) { |key, old, new| [key, old, new] }).to eql(merge)
         | 
| 18 18 | 
             
                end
         | 
| 19 19 | 
             
              end
         | 
| 20 20 | 
             
            end
         | 
| @@ -3,11 +3,11 @@ require 'spec_helper' | |
| 3 3 | 
             
            describe Squire::Parser::Hash do
         | 
| 4 4 | 
             
              subject { Squire::Parser::Hash }
         | 
| 5 5 |  | 
| 6 | 
            -
              it ' | 
| 6 | 
            +
              it 'parses source hash' do
         | 
| 7 7 | 
             
                source = { 'a' => 1, 'b' => 2, 'nested' => { 'c' => 2} }
         | 
| 8 8 |  | 
| 9 9 | 
             
                hash = subject.parse(source)
         | 
| 10 10 |  | 
| 11 | 
            -
                hash. | 
| 11 | 
            +
                expect(hash).to eql(source)
         | 
| 12 12 | 
             
              end
         | 
| 13 13 | 
             
            end
         | 
| @@ -3,10 +3,10 @@ require 'spec_helper' | |
| 3 3 | 
             
            describe Squire::Parser::YAML do
         | 
| 4 4 | 
             
              subject { described_class }
         | 
| 5 5 |  | 
| 6 | 
            -
              it ' | 
| 6 | 
            +
              it 'parses yaml file from path' do
         | 
| 7 7 | 
             
                hash = subject.parse(fixture('basic.yml').path)
         | 
| 8 8 |  | 
| 9 | 
            -
                hash. | 
| 9 | 
            +
                expect(hash).to eql(
         | 
| 10 10 | 
             
                  'defaults' => nil,
         | 
| 11 11 | 
             
                  'development' => {
         | 
| 12 12 | 
             
                    'a' => 1,
         | 
    
        data/spec/squire/proxy_spec.rb
    CHANGED
    
    | @@ -13,7 +13,7 @@ describe Squire::Proxy do | |
| 13 13 |  | 
| 14 14 | 
             
              let(:another) { AnotherProxiedConfiguration}
         | 
| 15 15 |  | 
| 16 | 
            -
              it ' | 
| 16 | 
            +
              it 'properly sets up proxied configuration' do
         | 
| 17 17 | 
             
                subject.squire.source    development: { a: 1, b: 2 }
         | 
| 18 18 | 
             
                subject.squire.namespace :development
         | 
| 19 19 |  | 
| @@ -21,26 +21,26 @@ describe Squire::Proxy do | |
| 21 21 | 
             
                  config.c = 3
         | 
| 22 22 | 
             
                end
         | 
| 23 23 |  | 
| 24 | 
            -
                subject.config.a. | 
| 25 | 
            -
                subject.config.b. | 
| 26 | 
            -
                subject.config.c. | 
| 24 | 
            +
                expect(subject.config.a).to eql(1)
         | 
| 25 | 
            +
                expect(subject.config.b).to eql(2)
         | 
| 26 | 
            +
                expect(subject.config.c).to eql(3)
         | 
| 27 27 |  | 
| 28 28 | 
             
                expect { subject.a }.to raise_error(NoMethodError)
         | 
| 29 29 | 
             
              end
         | 
| 30 30 |  | 
| 31 | 
            -
              it ' | 
| 31 | 
            +
              it 'properly sets up separate proxies' do
         | 
| 32 32 | 
             
                subject.squire.source    development: { a: 1, b: 2 }
         | 
| 33 33 | 
             
                subject.squire.namespace :development
         | 
| 34 34 |  | 
| 35 35 | 
             
                another.squire.source    production: { a: 3, b: 4 }
         | 
| 36 36 | 
             
                another.squire.namespace :production
         | 
| 37 37 |  | 
| 38 | 
            -
                subject.squire.namespace. | 
| 39 | 
            -
                subject.config.a. | 
| 40 | 
            -
                subject.config.b. | 
| 38 | 
            +
                expect(subject.squire.namespace).to eql(:development)
         | 
| 39 | 
            +
                expect(subject.config.a).to eql(1)
         | 
| 40 | 
            +
                expect(subject.config.b).to eql(2)
         | 
| 41 41 |  | 
| 42 | 
            -
                another.squire.namespace. | 
| 43 | 
            -
                another.config.a. | 
| 44 | 
            -
                another.config.b. | 
| 42 | 
            +
                expect(another.squire.namespace).to eql(:production)
         | 
| 43 | 
            +
                expect(another.config.a).to eql(3)
         | 
| 44 | 
            +
                expect(another.config.b).to eql(4)
         | 
| 45 45 | 
             
              end
         | 
| 46 46 | 
             
            end
         | 
| @@ -5,17 +5,17 @@ require 'spec_helper' | |
| 5 5 | 
             
            describe Squire::Settings do
         | 
| 6 6 | 
             
              subject { Squire::Settings }
         | 
| 7 7 |  | 
| 8 | 
            -
              it ' | 
| 8 | 
            +
              it 'defines simple configuration' do
         | 
| 9 9 | 
             
                config = subject.new
         | 
| 10 10 |  | 
| 11 11 | 
             
                config.a = 1
         | 
| 12 12 | 
             
                config.b = 2
         | 
| 13 13 |  | 
| 14 | 
            -
                config.a. | 
| 15 | 
            -
                config.b. | 
| 14 | 
            +
                expect(config.a).to eql(1)
         | 
| 15 | 
            +
                expect(config.b).to eql(2)
         | 
| 16 16 | 
             
              end
         | 
| 17 17 |  | 
| 18 | 
            -
              it ' | 
| 18 | 
            +
              it 'defines nested configuration' do
         | 
| 19 19 | 
             
                config = subject.new
         | 
| 20 20 |  | 
| 21 21 | 
             
                config.nested do |nested|
         | 
| @@ -26,11 +26,11 @@ describe Squire::Settings do | |
| 26 26 | 
             
                  nested.b = 2
         | 
| 27 27 | 
             
                end
         | 
| 28 28 |  | 
| 29 | 
            -
                config.nested.a. | 
| 30 | 
            -
                config.nested.b. | 
| 29 | 
            +
                expect(config.nested.a).to eql(1)
         | 
| 30 | 
            +
                expect(config.nested.b).to eql(2)
         | 
| 31 31 | 
             
              end
         | 
| 32 32 |  | 
| 33 | 
            -
              it ' | 
| 33 | 
            +
              it 'checks if the value is set' do
         | 
| 34 34 | 
             
                config = subject.new
         | 
| 35 35 |  | 
| 36 36 | 
             
                config.a = 1
         | 
| @@ -38,13 +38,13 @@ describe Squire::Settings do | |
| 38 38 | 
             
                  nested.b = 2
         | 
| 39 39 | 
             
                end
         | 
| 40 40 |  | 
| 41 | 
            -
                config.a | 
| 42 | 
            -
                config.nested.b | 
| 43 | 
            -
                config.nested.a | 
| 44 | 
            -
                config.global | 
| 41 | 
            +
                expect(config.a?).to        be_true
         | 
| 42 | 
            +
                expect(config.nested.b?).to be_true
         | 
| 43 | 
            +
                expect(config.nested.a?).to be_false
         | 
| 44 | 
            +
                expect(config.global?).to   be_false
         | 
| 45 45 | 
             
              end
         | 
| 46 46 |  | 
| 47 | 
            -
              it ' | 
| 47 | 
            +
              it 'caches value after setting' do
         | 
| 48 48 | 
             
                config = subject.new
         | 
| 49 49 |  | 
| 50 50 | 
             
                config.a = 1
         | 
| @@ -52,18 +52,30 @@ describe Squire::Settings do | |
| 52 52 | 
             
                  nested.b = 2
         | 
| 53 53 | 
             
                end
         | 
| 54 54 |  | 
| 55 | 
            -
                config. | 
| 56 | 
            -
                config.nested. | 
| 55 | 
            +
                expect(config).to respond_to(:a)
         | 
| 56 | 
            +
                expect(config.nested).to respond_to(:b)
         | 
| 57 57 | 
             
              end
         | 
| 58 58 |  | 
| 59 | 
            -
              it ' | 
| 59 | 
            +
              it 'raises error when setting is missing' do
         | 
| 60 60 | 
             
                config = subject.new
         | 
| 61 61 |  | 
| 62 62 | 
             
                expect { config.a }.to raise_error(Squire::MissingSettingError, /Missing setting 'a'/)
         | 
| 63 63 | 
             
              end
         | 
| 64 64 |  | 
| 65 | 
            +
              it 'behaves as plain object' do
         | 
| 66 | 
            +
                config = subject.new
         | 
| 67 | 
            +
             | 
| 68 | 
            +
                config.puts = 1
         | 
| 69 | 
            +
                config.test do |nested|
         | 
| 70 | 
            +
                  nested.a = 2
         | 
| 71 | 
            +
                end
         | 
| 72 | 
            +
             | 
| 73 | 
            +
                expect(config.puts).to eql(1)
         | 
| 74 | 
            +
                expect(config.test.a).to eql(2)
         | 
| 75 | 
            +
              end
         | 
| 76 | 
            +
             | 
| 65 77 | 
             
              describe '#to_s' do
         | 
| 66 | 
            -
                it ' | 
| 78 | 
            +
                it 'converts settings to string representation' do
         | 
| 67 79 | 
             
                  config = subject.new
         | 
| 68 80 |  | 
| 69 81 | 
             
                  config.a = 1
         | 
| @@ -73,24 +85,24 @@ describe Squire::Settings do | |
| 73 85 | 
             
                    nested.c = 3
         | 
| 74 86 | 
             
                  end
         | 
| 75 87 |  | 
| 76 | 
            -
                  config.to_s. | 
| 88 | 
            +
                  expect(config.to_s).to eql('#<Squire::Settings a=1, b=2, nested=#<Squire::Settings c=3>>')
         | 
| 77 89 | 
             
                end
         | 
| 78 90 | 
             
              end
         | 
| 79 91 |  | 
| 80 92 | 
             
              describe '#[]' do
         | 
| 81 | 
            -
                it ' | 
| 93 | 
            +
                it 'allows accesing keys in hash manner' do
         | 
| 82 94 | 
             
                  config = subject.new
         | 
| 83 95 |  | 
| 84 96 | 
             
                  config.a = 1
         | 
| 85 97 |  | 
| 86 | 
            -
                  config[:a]. | 
| 87 | 
            -
                  config['a']. | 
| 88 | 
            -
                  config[:b]. | 
| 98 | 
            +
                  expect(config[:a]).to  eql(1)
         | 
| 99 | 
            +
                  expect(config['a']).to eql(1)
         | 
| 100 | 
            +
                  expect(config[:b]).to  be_nil
         | 
| 89 101 | 
             
                end
         | 
| 90 102 | 
             
              end
         | 
| 91 103 |  | 
| 92 104 | 
             
              describe '#to_hash' do
         | 
| 93 | 
            -
                it ' | 
| 105 | 
            +
                it 'properly dumps settings as hash' do
         | 
| 94 106 | 
             
                  config = subject.new
         | 
| 95 107 |  | 
| 96 108 | 
             
                  config.a = 1
         | 
| @@ -105,7 +117,7 @@ describe Squire::Settings do | |
| 105 117 | 
             
                    end
         | 
| 106 118 | 
             
                  end
         | 
| 107 119 |  | 
| 108 | 
            -
                  config.to_hash. | 
| 120 | 
            +
                  expect(config.to_hash).to eql({
         | 
| 109 121 | 
             
                    a: 1,
         | 
| 110 122 | 
             
                    b: 2,
         | 
| 111 123 | 
             
                    nested: {
         | 
| @@ -120,7 +132,7 @@ describe Squire::Settings do | |
| 120 132 | 
             
              end
         | 
| 121 133 |  | 
| 122 134 | 
             
              describe '.from_hash' do
         | 
| 123 | 
            -
                it ' | 
| 135 | 
            +
                it 'parses settings from hash' do
         | 
| 124 136 | 
             
                  settings = subject.from_hash({
         | 
| 125 137 | 
             
                    a: 1,
         | 
| 126 138 | 
             
                    b: 2,
         | 
| @@ -133,15 +145,15 @@ describe Squire::Settings do | |
| 133 145 | 
             
                    }
         | 
| 134 146 | 
             
                  })
         | 
| 135 147 |  | 
| 136 | 
            -
                  settings.a. | 
| 137 | 
            -
                  settings.b. | 
| 148 | 
            +
                  expect(settings.a).to eql(1)
         | 
| 149 | 
            +
                  expect(settings.b).to eql(2)
         | 
| 138 150 |  | 
| 139 151 | 
             
                  settings.nested do |nested|
         | 
| 140 | 
            -
                    nested.c. | 
| 141 | 
            -
                    nested.d. | 
| 152 | 
            +
                    expect(nested.c).to eql(3)
         | 
| 153 | 
            +
                    expect(nested.d).to eql(4)
         | 
| 142 154 |  | 
| 143 155 | 
             
                    nested.other do |other|
         | 
| 144 | 
            -
                      other.e. | 
| 156 | 
            +
                      expect(other.e).to eql(5)
         | 
| 145 157 | 
             
                    end
         | 
| 146 158 | 
             
                  end
         | 
| 147 159 | 
             
                end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,27 +1,27 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: squire
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.3.6
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Samuel Molnar
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2014-02-17 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activesupport
         | 
| 15 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 16 | 
             
                requirements:
         | 
| 17 | 
            -
                - -  | 
| 17 | 
            +
                - - '>='
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 19 | 
             
                    version: 3.0.0
         | 
| 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 26 | 
             
                    version: 3.0.0
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| @@ -42,42 +42,42 @@ dependencies: | |
| 42 42 | 
             
              name: pry
         | 
| 43 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 44 | 
             
                requirements:
         | 
| 45 | 
            -
                - -  | 
| 45 | 
            +
                - - '>='
         | 
| 46 46 | 
             
                  - !ruby/object:Gem::Version
         | 
| 47 47 | 
             
                    version: '0'
         | 
| 48 48 | 
             
              type: :development
         | 
| 49 49 | 
             
              prerelease: false
         | 
| 50 50 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 51 | 
             
                requirements:
         | 
| 52 | 
            -
                - -  | 
| 52 | 
            +
                - - '>='
         | 
| 53 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 54 | 
             
                    version: '0'
         | 
| 55 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 56 56 | 
             
              name: fuubar
         | 
| 57 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 58 | 
             
                requirements:
         | 
| 59 | 
            -
                - -  | 
| 59 | 
            +
                - - '>='
         | 
| 60 60 | 
             
                  - !ruby/object:Gem::Version
         | 
| 61 61 | 
             
                    version: '0'
         | 
| 62 62 | 
             
              type: :development
         | 
| 63 63 | 
             
              prerelease: false
         | 
| 64 64 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 65 | 
             
                requirements:
         | 
| 66 | 
            -
                - -  | 
| 66 | 
            +
                - - '>='
         | 
| 67 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 68 68 | 
             
                    version: '0'
         | 
| 69 69 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 70 70 | 
             
              name: settingslogic
         | 
| 71 71 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 72 | 
             
                requirements:
         | 
| 73 | 
            -
                - -  | 
| 73 | 
            +
                - - '>='
         | 
| 74 74 | 
             
                  - !ruby/object:Gem::Version
         | 
| 75 75 | 
             
                    version: '0'
         | 
| 76 76 | 
             
              type: :development
         | 
| 77 77 | 
             
              prerelease: false
         | 
| 78 78 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 79 79 | 
             
                requirements:
         | 
| 80 | 
            -
                - -  | 
| 80 | 
            +
                - - '>='
         | 
| 81 81 | 
             
                  - !ruby/object:Gem::Version
         | 
| 82 82 | 
             
                    version: '0'
         | 
| 83 83 | 
             
            description: Squire handles your configuration by common config DSL.
         | 
| @@ -128,17 +128,17 @@ require_paths: | |
| 128 128 | 
             
            - lib
         | 
| 129 129 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 130 130 | 
             
              requirements:
         | 
| 131 | 
            -
              - -  | 
| 131 | 
            +
              - - '>='
         | 
| 132 132 | 
             
                - !ruby/object:Gem::Version
         | 
| 133 133 | 
             
                  version: '0'
         | 
| 134 134 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 135 135 | 
             
              requirements:
         | 
| 136 | 
            -
              - -  | 
| 136 | 
            +
              - - '>='
         | 
| 137 137 | 
             
                - !ruby/object:Gem::Version
         | 
| 138 138 | 
             
                  version: '0'
         | 
| 139 139 | 
             
            requirements: []
         | 
| 140 140 | 
             
            rubyforge_project: 
         | 
| 141 | 
            -
            rubygems_version: 2. | 
| 141 | 
            +
            rubygems_version: 2.0.3
         | 
| 142 142 | 
             
            signing_key: 
         | 
| 143 143 | 
             
            specification_version: 4
         | 
| 144 144 | 
             
            summary: Squire handles your configuration per class/file by common config DSL and
         |