dry-container 0.2.3 → 0.2.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e0557915422ea3394041cf54aca9b2d10f821b4
4
- data.tar.gz: 0e42f3357d831512ddedca606657b28f0bccec7c
3
+ metadata.gz: b9d5dcf90fab6c72fb271675c0f9b503de608c99
4
+ data.tar.gz: 8badbe2f97c47f1c35c58fa3ce5b0c96a33d1028
5
5
  SHA512:
6
- metadata.gz: 2b9c593a257dae4a0e3a756567055e5c89254a6d9c6dcc7ae2905967f97c3efa738eb6ae7d99496a3d8fff9e1555d899fdac8650af7b5cb17a63d2ab673f7b73
7
- data.tar.gz: 218b65a59e91cd892dbd499db7b0ea46c3ce03d9d39e1d2e33ff7be1547b090c74c0f9ea635a8e09808eb6d4be0610e2eb69be7f9fb914d8930a661d7bbea41c
6
+ metadata.gz: f77c0db7d4dbdb22072d9bb19930d14841a2bd970996f66d7791a5443669674c770f03f7e4019986197c7bb6fdd24a554387e6716e6d778b38bf768bbaaa2df0
7
+ data.tar.gz: 3a813c8425288428f7cb963ff1f16222b094c4ebcda8db8cd3aeb3a8216e2532bf081e492bda49c4171bee7a178a3267889cb34c7c44b00e940e43c9d05440b5
@@ -9,7 +9,7 @@ module Dry
9
9
  def initialize(item, options = {})
10
10
  @item = item
11
11
  @options = {
12
- call: item.is_a?(::Proc)
12
+ call: item.is_a?(::Proc) && item.arity == 0
13
13
  }.merge(options)
14
14
  end
15
15
 
@@ -1,6 +1,6 @@
1
1
  module Dry
2
2
  class Container
3
3
  # @api public
4
- VERSION = '0.2.3'.freeze
4
+ VERSION = '0.2.4'.freeze
5
5
  end
6
6
  end
@@ -112,10 +112,20 @@ shared_examples 'a container' do
112
112
  context 'with default configuration' do
113
113
  describe 'registering a block' do
114
114
  context 'without options' do
115
- it 'registers and resolves an object' do
116
- container.register(:item) { 'item' }
115
+ context 'without arguments' do
116
+ it 'registers and resolves an object' do
117
+ container.register(:item) { 'item' }
118
+
119
+ expect(container.resolve(:item)).to eq('item')
120
+ end
121
+ end
122
+
123
+ context 'with arguments' do
124
+ it 'registers and resolves a proc' do
125
+ container.register(:item) { |item| item }
117
126
 
118
- expect(container.resolve(:item)).to eq('item')
127
+ expect(container.resolve(:item).call('item')).to eq('item')
128
+ end
119
129
  end
120
130
  end
121
131
 
@@ -131,11 +141,22 @@ shared_examples 'a container' do
131
141
 
132
142
  describe 'registering a proc' do
133
143
  context 'without options' do
134
- it 'registers and resolves an object' do
135
- container.register(:item, proc { 'item' })
144
+ context 'without arguments' do
145
+ it 'registers and resolves an object' do
146
+ container.register(:item, proc { 'item' })
147
+
148
+ expect(container.resolve(:item)).to eq('item')
149
+ expect(container[:item]).to eq('item')
150
+ end
151
+ end
152
+
153
+ context 'with arguments' do
154
+ it 'registers and resolves a proc' do
155
+ container.register(:item, proc { |item| item })
136
156
 
137
- expect(container.resolve(:item)).to eq('item')
138
- expect(container[:item]).to eq('item')
157
+ expect(container.resolve(:item).call('item')).to eq('item')
158
+ expect(container[:item].call('item')).to eq('item')
159
+ end
139
160
  end
140
161
  end
141
162
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-container
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Holland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-14 00:00:00.000000000 Z
11
+ date: 2015-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thread_safe