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

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

Closed
@rlue

Description

@rlue

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions