Permalink
Browse files

Print error if something goes wrong in deploy.

  • Loading branch information...
1 parent 6359702 commit c27f13fab296765705a4b14c6aa8808cba47a71f @gabebw gabebw committed Oct 7, 2011
Showing with 12 additions and 5 deletions.
  1. +2 −1 lib/kumade/deployer.rb
  2. +10 −4 spec/kumade/deployer_spec.rb
View
3 lib/kumade/deployer.rb
@@ -18,7 +18,8 @@ def deploy
pre_deploy
heroku.sync
heroku.migrate_database
- rescue
+ rescue => deploying_error
+ Kumade.outputter.error("#{deploying_error.class}: #{deploying_error.message}")
ensure
post_deploy
end
View
14 spec/kumade/deployer_spec.rb
@@ -28,12 +28,18 @@
subject.deploy
end
- it "calls post_deploy if deploy fails" do
- subject.git.stubs(:heroku_remote?).raises(RuntimeError)
+ context "if deploy fails" do
+ before { subject.git.stubs(:heroku_remote?).raises(RuntimeError.new("fun times")) }
- subject.expects(:post_deploy)
+ it "calls post_deploy" do
+ subject.expects(:post_deploy)
+ subject.deploy
+ end
- subject.deploy
+ it "prints the error" do
+ subject.deploy
+ Kumade.outputter.should have_received(:error).with("RuntimeError: fun times")
+ end
end
end

0 comments on commit c27f13f

Please sign in to comment.