Skip to content
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

irb: warn: can't alias context from irb_context. #2776

Closed
rlue opened this issue Oct 23, 2020 · 1 comment
Closed

irb: warn: can't alias context from irb_context. #2776

rlue opened this issue Oct 23, 2020 · 1 comment

Comments

@rlue
Copy link

rlue commented Oct 23, 2020

Subject of the issue

I see that this bug was described in rspec-rails #1693 over four years ago, but I'm still seeing it in the most recent minor versions of Ruby and RSpec (2.7 / 3.9).

When executing irb -r <module>, if the given module is either a) RSpec or b) a script that requires RSpec in turn, then the following warning will be printed to the console:

irb: warn: can't alias context from irb_context.

Note that calling require 'rspec' from within irb does not produce the warning:

irb(main):001:0> require 'rspec'
=> true

Your environment

  • Ruby version: 2.7.0
  • rspec-core version: 3.9.0

Steps to reproduce

$ mkdir bug
$ cd bug
$ bundle init
$ echo "gem 'rspec'" >> Gemfile
$ bundle install
$ bundle exec irb -r rspec

Expected behavior

IRB console should be invoked without warning; i.e.:

$ bundle exec irb -r rspec
irb(main):001:0>

Actual behavior

$ bundle exec irb -r rspec
irb: warn: can't alias context from irb_context.
irb(main):001:0>
@JonRowe JonRowe closed this as completed Oct 23, 2020
@JonRowe
Copy link
Member

JonRowe commented Oct 23, 2020

This because by default RSpec monkey patches context into the top level, disable monkey patching to silence it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants