Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Clean up base spec, less stubbing of subject

  • Loading branch information...
commit 40882dfb60cd72128de09271e9fb7b2cf9bb0b21 1 parent 30e0b3e
Gabe Berke-Williams gabebw authored
Showing with 10 additions and 12 deletions.
  1. +10 −12 spec/kumade/base_spec.rb
22 spec/kumade/base_spec.rb
View
@@ -1,18 +1,15 @@
require 'spec_helper'
describe Kumade::Base, "#success" do
- it "exists" do
- subject.should respond_to(:success)
- end
+ it { should respond_to(:success) }
end
describe Kumade::Base, "#error" do
- it "exists" do
- subject.should respond_to(:error)
- end
+ it { should respond_to(:error) }
it "prints its message and raises its message" do
- subject.should_receive(:say).with("==> ! I'm an error!", :red)
+ STDOUT.should_receive(:puts).with(/I'm an error!/)
+
lambda { subject.error("I'm an error!") }.should raise_error(Kumade::DeploymentError)
end
end
@@ -37,15 +34,16 @@
end
context "when not pretending" do
- context "with success" do
- it "should not call error" do
- subject.should_receive(:run).and_return(true)
- subject.should_receive(:error).never
+ context "when it runs successfully" do
+ it "does not print an error" do
+ STDOUT.should_not_receive(:puts).with(/#{error_message}/)
+ Cocaine::CommandLine.stub(:new).and_return(stub(:run => true))
+
subject.run_or_error(command, error_message)
end
end
- context "without success" do
+ context "when it does not run successfully " do
it "should call CommandLine.run and error with error_message" do
subject.should_receive(:run).and_return(false)
subject.should_receive(:error).with(error_message)
Please sign in to comment.
Something went wrong with that request. Please try again.