sinclair 2.1.0 → 2.1.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
  SHA256:
3
- metadata.gz: bca1f4b9666c1916f4131d87e1f2acb9d417b0190bad68502299b0aa597dd19c
4
- data.tar.gz: 329ca4de9e7ed56c10c6306801fd001a4a10eb890a9e145cb2a5db7009afbf75
3
+ metadata.gz: d76ebc93311a132641b78144b2b81a05c84fade374cc0d149ff0164b9a5e07ff
4
+ data.tar.gz: 90bac707ca24a39baed7352cffa1ffcba9f3f7082077caf1d0cd20e9eb1021fb
5
5
  SHA512:
6
- metadata.gz: b5b81908de91bc67ad5aa309d212ed5f3250f2ff01b78c0549ba1bb137f07955462ef6f4b48f998fbb36917cc0a739b2befe80b9798906d4ca00c1d5cdd71468
7
- data.tar.gz: a53161407bbafb1a1150b4a6643af49bbab613290bbbcdd7fe839575384a4b954d3bc17feeb7943b409a09db7a74a690184590d59d5452b2e00769c1e4e9826c
6
+ metadata.gz: 6c0e1ee48effffc16883f6d1b514089e0673d073970131ea9e1ba480fbfb4dbc4d4bc871d3dcd92d21aebb3e78b36cb7e775493bfb8f490ad6cedebe0a8e1e1a
7
+ data.tar.gz: f48a3a61574f6b9d66122a0a23b1f709ac29f36b5dbd41bd246908280779fafc9bc42ad494d4da21b70772323bd43bfff5848ed8941229f01a8d4da8b8180e7c
data/README.md CHANGED
@@ -15,13 +15,13 @@ create custom comparators, configure your application, create powerfull options,
15
15
 
16
16
  Employing Sinclair in your applications helps you streamline your development workflow and enhance your development process through more efficient, cleaner code
17
17
 
18
- Current Release: [2.1.0](https://github.com/darthjee/sinclair/tree/2.1.0)
18
+ Current Release: [2.1.1](https://github.com/darthjee/sinclair/tree/2.1.1)
19
19
 
20
- [Next release](https://github.com/darthjee/sinclair/compare/2.1.0...master)
20
+ [Next release](https://github.com/darthjee/sinclair/compare/2.1.1...master)
21
21
 
22
22
  Yard Documentation
23
23
  -------------------
24
- [https://www.rubydoc.info/gems/sinclair/2.1.0](https://www.rubydoc.info/gems/sinclair/2.1.0)
24
+ [https://www.rubydoc.info/gems/sinclair/2.1.1](https://www.rubydoc.info/gems/sinclair/2.1.1)
25
25
 
26
26
  Installation
27
27
  ---------------
@@ -12,7 +12,7 @@ class Sinclair
12
12
  include Sinclair::Settable
13
13
  extend Sinclair::Settable::ClassMethods
14
14
 
15
- read_with do |key, sources: nil, sources_map: {}|
15
+ read_with do |key, sources: nil|
16
16
  sources.map_and_find do |source|
17
17
  sources_map[source].public_send(key)
18
18
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Sinclair
4
- VERSION = '2.1.0'
4
+ VERSION = '2.1.1'
5
5
  end
@@ -5,20 +5,22 @@ require 'spec_helper'
5
5
  describe Sinclair::ChainSettable do
6
6
  subject(:settable) do
7
7
  options = options_hash
8
+ env_setting = env_setting_class
8
9
 
9
10
  Class.new do
10
11
  extend Sinclair::ChainSettable
11
12
 
12
- source :app_client, Class.new(NonDefaultAppClient)
13
+ source :app_client, env_setting
13
14
  source :my_app_client, Class.new(MyAppClient)
14
15
 
15
16
  setting_with_options :username, :password, :host, :port, **options
16
17
  end
17
18
  end
18
19
 
19
- let(:options_hash) { {} }
20
- let(:username) { 'my_login' }
21
- let(:password) { Random.rand(10_000).to_s }
20
+ let(:env_setting_class) { Class.new(NonDefaultAppClient) }
21
+ let(:options_hash) { {} }
22
+ let(:username) { 'my_login' }
23
+ let(:password) { Random.rand(10_000).to_s }
22
24
 
23
25
  context 'when the first setting finds the data' do
24
26
  let(:username_key) { 'USERNAME' }
@@ -73,4 +75,35 @@ describe Sinclair::ChainSettable do
73
75
  expect(settable.username).to eq(default)
74
76
  end
75
77
  end
78
+
79
+ context 'when there is a subclass with diferent sources' do
80
+ subject(:second_settable) do
81
+ env_setting = second_env_setting_class
82
+
83
+ Class.new(settable) do
84
+ source :app_client, env_setting
85
+ source :my_app_client, Class.new(MyAppClient)
86
+ end
87
+ end
88
+
89
+ let(:first_username) { 'first_username' }
90
+ let(:second_username) { 'second_username' }
91
+ let(:second_env_setting_class) do
92
+ Class.new(MyAppClient)
93
+ end
94
+
95
+ before do
96
+ ENV['USERNAME'] = first_username
97
+ ENV['MY_APP_USERNAME'] = second_username
98
+ end
99
+
100
+ after do
101
+ ENV.delete('USERNAME')
102
+ ENV.delete('MY_APP_USERNAME')
103
+ end
104
+
105
+ it 'returns different values' do
106
+ expect(settable.username).not_to eq(second_settable.username)
107
+ end
108
+ end
76
109
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinclair
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - DarthJee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-30 00:00:00.000000000 Z
11
+ date: 2023-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport