Permalink
Browse files

CommandLine#run_or_error now returns the result of running the command.

This fixes the broken check for the Cedar stack.
  • Loading branch information...
Gabe Berke-Williams
Gabe Berke-Williams committed Oct 21, 2011
1 parent 3180ad2 commit 4b7358eb029dd98656a77a61d814c8fa80014898
Showing with 18 additions and 10 deletions.
  1. +0 −1 lib/kumade/command_line.rb
  2. +18 −9 spec/kumade/command_line_spec.rb
@@ -18,7 +18,6 @@ def run_with_status
def run
begin
@command_line.run
- true
rescue Cocaine::ExitStatusError, Cocaine::CommandNotFoundError
false
end
@@ -4,7 +4,7 @@
subject { Kumade::CommandLine.new("echo") }
context "when pretending" do
- let(:command_line) { stub("Cocaine::CommandLine instance", :run => nil, :command => 'command') }
+ let(:command_line) { stub("Cocaine::CommandLine instance", :run => "does-not-matter", :command => 'command') }
before do
Cocaine::CommandLine.stubs(:new).returns(command_line)
@@ -24,12 +24,16 @@
end
context "when successful" do
+ let(:command_line) { stub("Cocaine::CommandLine instance", :run => command_line_result, :command => 'command') }
+ let(:command_line_result) { "result" }
+
before do
+ Cocaine::CommandLine.stubs(:new).returns(command_line)
Kumade.configuration.pretending = false
end
- it "returns true" do
- subject.run_or_error.should be_true
+ it "returns the result of running the command" do
+ subject.run_or_error.should == command_line_result
end
end
@@ -48,8 +52,9 @@
end
describe Kumade::CommandLine, "#run_with_status", :with_mock_outputter do
- let(:command) { "echo" }
- let(:command_line) { stub("Cocaine::CommandLine instance", :run => nil, :command => command) }
+ let(:command) { "echo blah" }
+ let(:command_line_result) { "blah\n" }
+ let(:command_line) { stub("Cocaine::CommandLine instance", :run => command_line_result, :command => command) }
subject { Kumade::CommandLine.new(command) }
before do
@@ -72,7 +77,7 @@
end
it "returns true" do
- subject.run_with_status.should be_true
+ subject.run_with_status.should == true
end
end
@@ -84,15 +89,19 @@
command_line.should have_received(:run).once
end
+
+ it "returns the result of running the command" do
+ subject.run_with_status.should == command_line_result
+ end
end
end
describe Kumade::CommandLine, "#run", :with_mock_outputter do
context "when successful" do
- subject { Kumade::CommandLine.new("echo") }
+ subject { Kumade::CommandLine.new("echo -n blah") }
- it "returns true" do
- subject.run.should == true
+ it "returns the result of running the command" do
+ subject.run.should == "blah"
end
end

0 comments on commit 4b7358e

Please sign in to comment.