diff --git a/spec/datadog/core/environment/execution_spec.rb b/spec/datadog/core/environment/execution_spec.rb index 19699850c27..0324384c511 100644 --- a/spec/datadog/core/environment/execution_spec.rb +++ b/spec/datadog/core/environment/execution_spec.rb @@ -58,10 +58,10 @@ context 'when in an IRB session' do it 'returns true' do - _, err = Bundler.with_clean_env do # Ruby 2.6 does not have irb by default in a bundle, but has it outside of it. - Open3.capture3('irb', '--noprompt', '--noverbose', stdin_data: repl_script) + _, err, = Bundler.with_clean_env do # Ruby 2.6 does not have irb by default in a bundle, but has it outside of it. + Open3.capture3('irb', '--noprompt', '--noverbose', '--noecho', stdin_data: repl_script) end - expect(err).to end_with('true') + expect(err).to end_with('ACTUAL:true') end end @@ -71,8 +71,8 @@ f.write(repl_script) f.close - out, = Open3.capture2e('pry', '-f', '--noprompt', f.path) - expect(out).to eq('ACTUAL:true') + _, err, = Open3.capture3('pry', '-f', '--noprompt', f.path) + expect(err).to end_with('ACTUAL:true') end end end @@ -129,7 +129,7 @@ def test_it_does_something_useful it 'returns true' do _, err, = Open3.capture3('ruby', stdin_data: script) - expect(err).to end_with('true') + expect(err).to end_with('ACTUAL:true') end end @@ -187,9 +187,10 @@ 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_clean_env do + _, err, = Bundler.with_clean_env do Open3.capture3('ruby', stdin_data: script) end + expect(err).to include('ACTUAL:true') end end @@ -253,7 +254,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, err = Bundler.with_clean_env do + out, = Bundler.with_clean_env do Open3.capture3('ruby', stdin_data: <<-RUBY require 'bundler/inline' @@ -269,13 +270,12 @@ def test_it_does_something_useful $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'datadog/core/environment/execution' - STDOUT.print Datadog::Core::Environment::Execution.webmock_enabled? + STDOUT.print "ACTUAL:\#{Datadog::Core::Environment::Execution.webmock_enabled?}" RUBY ) end - expect(err).to be_empty - expect(out).to eq('true') + expect(out).to end_with('ACTUAL:true') end end end