dependor 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/dependor/isolate.rb +3 -2
- data/lib/dependor/version.rb +1 -1
- data/spec/dependor/isolate_spec.rb +11 -0
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/lib/dependor/isolate.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
module Dependor::Isolate
|
2
|
-
def isolate(klass)
|
2
|
+
def isolate(klass, overrides = {})
|
3
3
|
injector = Dependor::SendingInjector.new(self)
|
4
|
-
|
4
|
+
customized_injector = Dependor::CustomizedInjector.new(injector, overrides)
|
5
|
+
instantiator = Dependor::Instantiator.new(customized_injector)
|
5
6
|
instantiator.instantiate(klass)
|
6
7
|
end
|
7
8
|
end
|
data/lib/dependor/version.rb
CHANGED
@@ -12,6 +12,10 @@ describe Dependor::Isolate do
|
|
12
12
|
isolate(ExampleSubject)
|
13
13
|
end
|
14
14
|
|
15
|
+
def override
|
16
|
+
isolate(ExampleSubject, bar: "bar was overriden")
|
17
|
+
end
|
18
|
+
|
15
19
|
def foo
|
16
20
|
"the foo stub"
|
17
21
|
end
|
@@ -27,4 +31,11 @@ describe Dependor::Isolate do
|
|
27
31
|
context.subject.foo.should == "the foo stub"
|
28
32
|
context.subject.bar.should == "the bar stub"
|
29
33
|
end
|
34
|
+
|
35
|
+
it "allows overriding dependencies" do
|
36
|
+
context = ExampleContext.new
|
37
|
+
|
38
|
+
context.override.bar.should == "bar was overriden"
|
39
|
+
context.override.foo.should == "the foo stub"
|
40
|
+
end
|
30
41
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dependor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -166,7 +166,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
166
166
|
version: '0'
|
167
167
|
segments:
|
168
168
|
- 0
|
169
|
-
hash:
|
169
|
+
hash: 85109981727052297
|
170
170
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
171
|
none: false
|
172
172
|
requirements:
|
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
175
|
version: '0'
|
176
176
|
segments:
|
177
177
|
- 0
|
178
|
-
hash:
|
178
|
+
hash: 85109981727052297
|
179
179
|
requirements: []
|
180
180
|
rubyforge_project: dependor
|
181
181
|
rubygems_version: 1.8.24
|