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

Cop to enforce the first describe of a spec is defined as RSpec.describe #1272

Closed
schinery opened this issue May 7, 2022 · 2 comments
Closed

Comments

@schinery
Copy link

schinery commented May 7, 2022

I've checked the docs and don't believe this can currently be done, but would it be possible to create a cop that enforced the first describe of a spec has been defined as RSpec.describe?

So something like:

# Bad
describe SomeClass do
  describe "#does_something" do
    # ...
  end
end

# Good
RSpec.describe SomeClass do
  describe "#does_something" do
    # ...
  end
end
@pirj
Copy link
Member

pirj commented May 7, 2022

This is one of the non-goals.

The monkey-patching mode, top-level describe with no receiver, will be removed in RSpec 4. To ease up the process of upgrading, you can use Transpec, which will do the conversion for you.

@pirj pirj closed this as completed May 7, 2022
@schinery
Copy link
Author

schinery commented May 7, 2022

Cool, thanks @pirj.

I also discovered setting config.expose_dsl_globally = false will make any test not using RSpec. to blow which is good enough for now.

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