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 +4 -4
- data/lib/dry/container/item.rb +1 -1
- data/lib/dry/container/version.rb +1 -1
- data/spec/support/shared_examples/container.rb +28 -7
- 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: b9d5dcf90fab6c72fb271675c0f9b503de608c99
|
4
|
+
data.tar.gz: 8badbe2f97c47f1c35c58fa3ce5b0c96a33d1028
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f77c0db7d4dbdb22072d9bb19930d14841a2bd970996f66d7791a5443669674c770f03f7e4019986197c7bb6fdd24a554387e6716e6d778b38bf768bbaaa2df0
|
7
|
+
data.tar.gz: 3a813c8425288428f7cb963ff1f16222b094c4ebcda8db8cd3aeb3a8216e2532bf081e492bda49c4171bee7a178a3267889cb34c7c44b00e940e43c9d05440b5
|
data/lib/dry/container/item.rb
CHANGED
@@ -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
|
-
|
116
|
-
|
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
|
-
|
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
|
-
|
135
|
-
|
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
|
-
|
138
|
-
|
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.
|
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-
|
11
|
+
date: 2015-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thread_safe
|