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

Ignore bundler warnings on windows #281

Merged
merged 2 commits into from
May 26, 2016
Merged
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
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
### Development
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.5.0.beta1...master)

Enhancements:
* Improve `MethodSignature` to better support keyword arguments. (#250, Rob Smith).

Bug Fixes:

* Fix `ObjectFormatter` so that formatting objects that don't respond to
Expand Down
4 changes: 1 addition & 3 deletions lib/rspec/support/spec/library_wide_checks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ def load_all_files(files, preamble, postamble=nil)
run_ruby_with_current_load_path(command, *options)
end

# Ignore bundler warning.
stderr = stderr.split("\n").reject { |l| l =~ %r{bundler/source/rubygems} }.join("\n")
[stdout, stderr, status.exitstatus]
[stdout, strip_known_warnings(stderr), status.exitstatus]
end

define_method :load_all_lib_files do
Expand Down
11 changes: 11 additions & 0 deletions lib/rspec/support/spec/shell_out.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ def run_ruby_with_current_load_path(ruby_command, *flags)
end
end

def strip_known_warnings(input)
input.split("\n").reject do |l|
# Ignore bundler warning.
l =~ %r{bundler/source/rubygems} ||
# Ignore bundler + rubygems warning.
l =~ %r{site_ruby/\d\.\d\.\d/rubygems} ||
# This is required for windows for some reason
l =~ %r{lib/bundler/rubygems}
end.join("\n")
end

private

if Ruby.jruby?
Expand Down
4 changes: 2 additions & 2 deletions spec/rspec/support/spec/shell_out_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
it 'passes along the provided ruby flags' do
out, err, status = run_ruby_with_current_load_path('puts "version"', '-v')
expect(out).to include('version', RUBY_DESCRIPTION)
expect(err).to eq('')
expect(strip_known_warnings err).to eq('')
expect(status.exitstatus).to eq(0)
end

it 'filters out the annoying output issued by `ruby -w` when the GC ENV vars are set' do
with_env 'RUBY_GC_HEAP_FREE_SLOTS' => '10001', 'RUBY_GC_MALLOC_LIMIT' => '16777217', 'RUBY_FREE_MIN' => '10001' do
out, err, status = run_ruby_with_current_load_path('', '-w')
expect(out).to eq('')
expect(err).to eq('')
expect(strip_known_warnings err).to eq('')
expect(status.exitstatus).to eq(0)
end
end
Expand Down