Sha256: 687954d1be04bd6495e8abc9168273528ef3c6a7a9a5356858618669e7613b88
Contents?: true
Size: 1020 Bytes
Versions: 8
Compression:
Stored size: 1020 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
8 entries across 8 versions & 1 rubygems