Skip to content

Commit

Permalink
Raise error if stack deletion fails (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
ProZsolt authored and askreet committed Jul 25, 2017
1 parent 10f3548 commit 2577d5e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions lib/moonshot/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,13 @@ def delete

run_plugins(:pre_delete)
run_hook(:deploy, :pre_delete)
stack.delete
run_hook(:deploy, :post_delete)
run_plugins(:post_delete)
stack_ok = stack.delete
if stack_ok # rubocop:disable GuardClause
run_hook(:deploy, :post_delete)
run_plugins(:post_delete)
else
raise 'Stack deletion failed!'
end
end

def doctor
Expand Down
2 changes: 1 addition & 1 deletion spec/moonshot/plugins_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def post_create
end

it "doesn't call an undefined method" do
expect(stack).to receive(:delete)
expect(stack).to receive(:delete).and_return(true)

# The assertion here is that calling MockPlugin#pre_delete would cause an
# exception. Using an expect().not_to receive() changes the behavior of
Expand Down

0 comments on commit 2577d5e

Please sign in to comment.