Skip to content

Commit

Permalink
add exit status assertions to execution spec
Browse files Browse the repository at this point in the history
  • Loading branch information
p committed Dec 24, 2024
1 parent 49a1728 commit f62fcb2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions spec/datadog/core/environment/execution_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@
context 'when in an IRB session' do
it 'returns true' do
# Ruby 2.6 does not have irb by default in a bundle, but has it outside of it.
_, err, = Bundler.with_unbundled_env do
_, err, status = Bundler.with_unbundled_env do
Open3.capture3('irb', '--noprompt', '--noverbose', '--noecho', stdin_data: repl_script)
end
expect(err).to end_with('ACTUAL:true')
expect(status.exitstatus).to eq(0)
end
end

Expand Down Expand Up @@ -203,11 +204,12 @@ def test_it_does_something_useful
# Add our script to `env.rb`, which is always run before any feature is executed.
File.write('features/support/env.rb', repl_script)

_, err, = Bundler.with_unbundled_env do
_, err, status = Bundler.with_unbundled_env do
Open3.capture3('ruby', stdin_data: script)
end

expect(err).to include('ACTUAL:true')
expect(status.exitstatus).to eq(0)
end
end
end
Expand Down Expand Up @@ -270,7 +272,7 @@ def test_it_does_something_useful

context 'when given WebMock', skip: Gem::Version.new(Bundler::VERSION) < Gem::Version.new('2') do
it do
out, = Bundler.with_unbundled_env do
out, err, status = Bundler.with_unbundled_env do
Open3.capture3('ruby', stdin_data: <<-RUBY
require 'bundler/inline'
Expand All @@ -292,6 +294,7 @@ def test_it_does_something_useful
end

expect(out).to end_with('ACTUAL:true')
expect(status.exitstatus).to eq(0)
end
end
end
Expand Down

0 comments on commit f62fcb2

Please sign in to comment.