Sha256: adcd02c877127496ebb3e22553f1e226fea3dbddac53d3228db8f4dd78613e35
Contents?: true
Size: 1012 Bytes
Versions: 2
Compression:
Stored size: 1012 Bytes
Contents
require "spec_helper" require "mvcli/actions" describe "MVCLI::Actions" do Given(:loader) {mock(:Loader)} Given(:renderer) {mock(:Renderer, :render => true)} Given(:actions) {MVCLI::Actions.new '/root', loader, renderer} context "when the loader cannot find an appropriate controller" do Given {loader.stub(:load) {fail LoadError}} When(:action) {actions['foo']} Then {action.should_not be_nil} context ".calling it" do When(:result) {action.call(mock(:Command))} Then {result.should have_failed LoadError} end end context "when the class exists" do Given(:output) {mock(:Output)} Given(:controller) {mock(:Controller)} Given {loader.stub(:load).with(:controller, 'foo') {controller}} Given {controller.stub(:bar) {"the context"}} When {actions['foo#bar'].call(mock(:Command, :output => output))} Then {controller.should have_received(:bar)} And {renderer.should have_received(:render).with(output, 'foo/bar', 'the context')} end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mvcli-0.0.3 | spec/mvcli/actions_spec.rb |
mvcli-0.0.2 | spec/mvcli/actions_spec.rb |