Sha256: 95cd523f7364d71bb6b55622d969097e5663f95435a293d5c604b009ca925ca6
Contents?: true
Size: 1 KB
Versions: 3
Compression:
Stored size: 1 KB
Contents
require 'spec_helper' describe Dependor::Isolate do class ExampleSubject takes :foo, :bar end class ExampleContext include Dependor::Isolate def subject isolate{ExampleSubject} end def override 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 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 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
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dependor-1.0.1 | spec/dependor/isolate_spec.rb |
dependor-1.0.0 | spec/dependor/isolate_spec.rb |
dependor-0.0.6 | spec/dependor/isolate_spec.rb |