Skip to content

Small doc improvement #2250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 4, 2020
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
26 changes: 23 additions & 3 deletions features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,31 @@
module ArubaExt
def run_command(cmd, timeout = nil)
exec_cmd = cmd =~ /^rspec/ ? "bin/#{cmd}" : cmd
# Ensure bundler env vars are unset
unset_bundler_env_vars
# Ensure the correct Gemfile is found
# Ensure the correct Gemfile and binstubs are found
in_current_directory do
super(exec_cmd, timeout)
with_unbundled_env do
Copy link
Contributor

@mvz mvz Jan 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This call to with_unbundled_env is probably not needed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I tried without

And it breaked the build. So I rollback.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's surprising and I'm a little concerned that I don't know what is going on in my own fix, but if it works for now, I guess it's ok. Thanks for checking this, anyway.

super(exec_cmd, timeout)
end
end
end

def unset_bundler_env_vars
empty_env = with_environment { with_unbundled_env { ENV.to_h } }
aruba_env = aruba.environment.to_h
(aruba_env.keys - empty_env.keys).each do |key|
delete_environment_variable key
end
empty_env.each do |k, v|
set_environment_variable k, v
end
end

def with_unbundled_env
if Bundler.respond_to?(:with_unbundled_env)
Bundler.with_unbundled_env { yield }
else
Bundler.with_clean_env { yield }
end
end
end
Expand Down
4 changes: 3 additions & 1 deletion lib/rspec/rails/matchers/base_matcher.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
module RSpec
module Rails
module Matchers
# @ api private
# @api private
#
# Base class to build matchers. Should not be instantiated directly.
class BaseMatcher
include RSpec::Matchers::Composable

Expand Down
8 changes: 4 additions & 4 deletions lib/rspec/rails/matchers/have_http_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def invalid_response_type_message
# @example
# expect(response).to have_http_status(404)
#
# @see RSpec::Rails::Matchers.have_http_status
# @see RSpec::Rails::Matchers#have_http_status
class NumericCode < RSpec::Rails::Matchers::BaseMatcher
include HaveHttpStatus

Expand Down Expand Up @@ -123,7 +123,7 @@ def failure_message_when_negated
# @example
# expect(response).to have_http_status(:created)
#
# @see RSpec::Rails::Matchers.have_http_status
# @see RSpec::Rails::Matchers#have_http_status
# @see https://github.com/rack/rack/blob/master/lib/rack/utils.rb `Rack::Utils::SYMBOL_TO_STATUS_CODE`
class SymbolicStatus < RSpec::Rails::Matchers::BaseMatcher
include HaveHttpStatus
Expand Down Expand Up @@ -236,8 +236,8 @@ def set_expected_code!
# expect(response).to have_http_status(:missing)
# expect(response).to have_http_status(:redirect)
#
# @see RSpec::Rails::Matchers.have_http_status
# @see ActionDispatch::TestResponse
# @see RSpec::Rails::Matchers#have_http_status
# @see https://github.com/rails/rails/blob/6-0-stable/actionpack/lib/action_dispatch/testing/test_response.rb `ActionDispatch::TestResponse`
class GenericStatus < RSpec::Rails::Matchers::BaseMatcher
include HaveHttpStatus

Expand Down