Skip to content

Commit

Permalink
feat(can-i-deploy): puts output to stdout for both success and failur…
Browse files Browse the repository at this point in the history
…e scenarios so that JSON output can be parsed by capturing stdout
  • Loading branch information
bethesque committed Oct 17, 2017
1 parent 9c9a4bb commit 6db595a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 2 additions & 6 deletions lib/pact_broker/client/cli/broker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@ class Broker < Thor

def can_i_deploy(*selectors)
result = CanIDeploy.call(options.broker_base_url, selectors, {output: options.output}, pact_broker_client_options)
if result.success
$stdout.puts result.message
else
$stderr.puts result.message
exit(1)
end
$stdout.puts result.message
exit(1) unless result.success
end

desc 'version', "Show the pact_broker-client gem version"
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/pact_broker/client/cli/broker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ module CLI
let(:success) { false }

it "prints the message to stderr" do
expect($stderr).to receive(:puts).with(message)
expect($stdout).to receive(:puts).with(message)
begin
invoke_can_i_deploy
rescue SystemExit
Expand Down

0 comments on commit 6db595a

Please sign in to comment.