rspec / rspec-core

RSpec runner and formatters
http://rspec.info
MIT License
1.23k stars 765 forks source link

Requiring rspec before IRB console causes warning #3069

Closed wildmaples closed 9 months ago

wildmaples commented 9 months ago

Subject of the issue

Just a question but when we require this gem and use irb, we see this warning:

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

We realized it's because context is being added at the top level here: https://github.com/rspec/rspec-core/blob/main/lib/rspec/core/dsl.rb#L84

Your environment

Steps to reproduce

Expected behavior

There isn't really a problem with this behaviour but just curious to know if it is needed as context used in a describe block.

Actual behavior

JonRowe commented 9 months ago

If you turn off monkey patching with https://rspec.info/documentation/3.13/rspec-core/RSpec/Core/Configuration.html#disable_monkey_patching!-instance_method this should go away

(closing as duplicate of #2776)