spec/dependor/isolate_spec.rb in dependor-0.0.5 vs spec/dependor/isolate_spec.rb in dependor-0.0.6
- old
+ new
@@ -7,35 +7,43 @@
class ExampleContext
include Dependor::Isolate
def subject
- isolate(ExampleSubject)
+ isolate{ExampleSubject}
end
def override
- isolate(ExampleSubject, bar: "bar was overriden")
+ bar = "bar was overriden"
+ isolate{ExampleSubject}
end
+ def parameters
+ isolate(ExampleSubject, bar: "the parameter")
+ end
+
def foo
"the foo stub"
end
def bar
"the bar stub"
end
end
- it "injects the subject's dependencies using methods on context" do
- context = ExampleContext.new
+ let(:context) { ExampleContext.new }
+ it "injects the subject's dependencies using methods on context" do
context.subject.foo.should == "the foo stub"
context.subject.bar.should == "the bar stub"
end
- it "allows overriding dependencies" do
- context = ExampleContext.new
-
+ it "allows overriding dependencies with variables" do
context.override.bar.should == "bar was overriden"
context.override.foo.should == "the foo stub"
+ end
+
+ it "allows overriding dependencies with parameters" do
+ context.parameters.bar.should == "the parameter"
+ context.parameters.foo.should == "the foo stub"
end
end