spec/provider/heroku_spec.rb in dpl-heroku-1.10.14 vs spec/provider/heroku_spec.rb in dpl-heroku-1.10.15.travis.5877.5

- old
+ new

@@ -224,17 +224,29 @@ it "does not initiate legacy API object" do expect(provider).to receive(:faraday).at_least(:once).and_return(faraday) provider.trigger_build end - example do - expect(provider).to receive(:log).with('triggering new deployment') - expect(provider).to receive(:faraday).at_least(:once).and_return(faraday) - expect(provider).to receive(:get_url).and_return 'http://example.com/source.tgz' - expect(provider).to receive(:version).and_return 'v1.3.0' - expect(provider.context).to receive(:shell).with("curl -sS https://build-output.heroku.com/streams/01234567-89ab-cdef-0123-456789abcdef -H 'Accept: application/vnd.heroku+json; version=3' -H 'User-Agent: dpl/#{DPL::VERSION}'") - provider.trigger_build - expect(provider.build_id).to eq('01234567-89ab-cdef-0123-456789abcdef') + context 'when $stdout is a TTY' do + before do + @old_stdout = $stdout + $stdout = StringIO.new + allow($stdout).to receive(:isatty).and_return(true) + end + + after do + $stdout = @old_stdout + end + + example do + expect(provider).to receive(:log).with('triggering new deployment') + expect(provider).to receive(:faraday).at_least(:once).and_return(faraday) + expect(provider).to receive(:get_url).and_return 'http://example.com/source.tgz' + expect(provider).to receive(:version).and_return 'v1.3.0' + expect(provider.context).to receive(:shell).with("curl https://build-output.heroku.com/streams/01234567-89ab-cdef-0123-456789abcdef -H 'Accept: application/vnd.heroku+json; version=3' -H 'User-Agent: dpl/#{DPL::VERSION}'") + provider.trigger_build + expect(provider.build_id).to eq('01234567-89ab-cdef-0123-456789abcdef') + end end context 'when $stdout is not a TTY' do before do @old_stdout = $stdout