Sha256: f7ea993c9fd0a4ae473c32bb38d36ee3e007c4619d05cf3652c2184af5b05152
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 KB
Contents
require "spec_helper" require "mvcli/controller" describe "A Controller" do use_natural_assertions Given(:controller) { MVCLI::Controller.new name, method, params } Given(:cortex) { double(:Cortex) } Given(:command) { double(:Command, output: StringIO.new ) } Given { controller.stub(:cortex) { cortex } } Given { cortex.stub(:read) { proc { |context, output| @context, @output = context, output} } } context "when called with the 'show' action" do Given(:name) { 'servers' } Given(:method) { 'show' } Given(:params) { Map name: 'World' } Given { controller.stub(:show) { params } } When(:exit_status) { controller.call command } Then { exit_status == 0 } Then { @output == command.output } And { cortex.should have_received(:read).with :template, "servers/show"} context "when there's a corresponding form" do Given { controller.stub(:argv) { double(:argv, options: {}) } } Given { cortex.stub(:exists?).with(:form, "servers/show") { true } } Given { cortex.stub(:read).with(:form, "servers/show") { double(:Form, new: form) } } Given{ form.stub(:validate!) { true } } Given(:form) { double :form } Then{ controller.form == form } end context "when there's not a corresponding form" do end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mvcli-0.1.0 | spec/mvcli/controller_spec.rb |