Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 4131233

Browse files
committed
ignore bundler warnings in shell out specs
1 parent c1ef271 commit 4131233

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

spec/rspec/support/spec/shell_out_spec.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,26 @@
3333
it 'passes along the provided ruby flags' do
3434
out, err, status = run_ruby_with_current_load_path('puts "version"', '-v')
3535
expect(out).to include('version', RUBY_DESCRIPTION)
36-
expect(err).to eq('')
36+
expect(ignore_bundler_warnings err).to eq('')
3737
expect(status.exitstatus).to eq(0)
3838
end
3939

4040
it 'filters out the annoying output issued by `ruby -w` when the GC ENV vars are set' do
4141
with_env 'RUBY_GC_HEAP_FREE_SLOTS' => '10001', 'RUBY_GC_MALLOC_LIMIT' => '16777217', 'RUBY_FREE_MIN' => '10001' do
4242
out, err, status = run_ruby_with_current_load_path('', '-w')
4343
expect(out).to eq('')
44-
expect(err).to eq('')
44+
expect(ignore_bundler_warning err).to eq('')
4545
expect(status.exitstatus).to eq(0)
4646
end
4747
end
48+
49+
def ignore_bundler_warnings(input)
50+
input.split("\n").reject do |l|
51+
# Ignore bundler warning.
52+
l =~ %r{bundler/(source/)?rubygems} ||
53+
# Ignore bundler + rubygems warning.
54+
l =~ %r{site_ruby/\d\.\d\.\d/rubygems} ||
55+
l =~ %r{lib/bundler/rubygems}
56+
end.join("\n")
57+
end
4858
end

0 commit comments

Comments
 (0)