Sha256: c77282ddb51678bab324b6730361079cc7099a4f2605caf1ef80ba27569450b7
Contents?: true
Size: 1.44 KB
Versions: 1
Compression:
Stored size: 1.44 KB
Contents
require "spec_helper" require "mvcli/cortex" describe "A Cortex" do use_natural_assertions Given(:cortex) { MVCLI::Cortex.new } describe "without any cores" do When(:result) { cortex.read :extension, 'foo/bar/baz' } Then { result.should have_failed MVCLI::ExtensionNotFound } end describe "with a few cores" do Given(:core1) { add_core :Core1 } Given(:core2) { add_core :Core2 } context "when we access an object" do When(:extension) { cortex.read :controller, "admin/users" } context "and it is defined and exists" do Given { core1.stub(:read) { double(:Extension, core: 1) } } Given { core2.stub(:read) { double(:Extension, core: 2) } } Invariant { cortex.exists? :controller, "admin/users"} context "only in the first core" do Given { core1.stub(:exists?) { true } } Then { extension.core == 1} end context "only in the second core" do Given { core1.stub(:exists?) { false } } Given { core2.stub(:exists?) { true } } Then { extension.core == 2 } end context "in both cores" do Given { core1.stub(:exists?) { true} } Given { core2.stub(:exists?) { true } } Then { core1.should have_received(:read) } Then { core2.should_not have_received(:read) } end end end end def add_core(name) core = double name cortex << core return core end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mvcli-0.1.0 | spec/mvcli/cortex_spec.rb |