Skip to content

Commit

Permalink
fail fast on config:add
Browse files Browse the repository at this point in the history
  • Loading branch information
ddollar committed Nov 2, 2011
1 parent cea0907 commit dbd33ff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/heroku/command/config.rb
Expand Up @@ -36,20 +36,18 @@ def add
# try to get the app to fail fast
detected_app = app

display "Adding config vars:"
display_vars(vars, :indent => 2)

display "Restarting app...", false
display "Adding config vars and restarting app...", false
heroku.add_config_vars(detected_app, vars)

display " done", false

begin
release = heroku.releases(detected_app).last
display(", #{release["name"]}", false) if release
rescue RestClient::RequestFailed => e
end
display "."

display
display_vars(vars, :indent => 2)
end

# config:remove KEY1 [KEY2 ...]
Expand Down
10 changes: 10 additions & 0 deletions spec/heroku/command/config_spec.rb
Expand Up @@ -35,6 +35,16 @@ module Heroku::Command
@config.add
end

it "doesnt show config vars when an error occurs during add" do
Heroku::Command.should_receive(:error).with("command failed")
any_instance_of(Heroku::Client) do |client|
stub(client).add_config_vars do
raise CommandFailed, "command failed"
end
end
run("config:add A=newvalue").should_not =~ /newvalue/
end

it "allows config vars with = in the value" do
@config.stub!(:args).and_return(['a=b=c'])
@config.heroku.should_receive(:add_config_vars).with('myapp', {'a'=>'b=c'})
Expand Down

0 comments on commit dbd33ff

Please sign in to comment.