Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/dpl/provider/npm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def setup_auth
file = File.open(File.expand_path(NPMRC_FILE), 'w')
file.puts(npmrc_file_content)
file.flush
file.close
end

def check_auth
Expand Down
28 changes: 20 additions & 8 deletions spec/provider/heroku_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,26 @@
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
Expand Down
1 change: 1 addition & 0 deletions spec/provider/npm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,6 @@ def test_setup_auth(registry = DPL::Provider::NPM::DEFAULT_NPM_REGISTRY, content
expect(File).to receive(:open).with(File.expand_path(DPL::Provider::NPM::NPMRC_FILE), 'w').and_return(f)
expect(f).to receive(:puts).with(content)
allow(f).to receive(:flush)
allow(f).to receive(:close)
provider.setup_auth
end