Skip to content

Commit

Permalink
Merge pull request #745 from QWYNG/add_rubocop_rspec_support
Browse files Browse the repository at this point in the history
Add support for rubocop-rspec syntax extensions
  • Loading branch information
Burgestrand authored Oct 19, 2022
2 parents 56af8f3 + 6279549 commit a5d756a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,16 @@ An alternative approach to Pundit policy specs is scoping them to a user context

Pundit does not provide a DSL for testing scopes. Just test it like a regular Ruby class!

### Linting with RuboCop RSpec

When you lint your RSpec spec files with `rubocop-rspec`, it will fail to properly detect RSpec constructs that Pundit defines, `permissions`.
Make sure to use `rubocop-rspec` 2.0 or newer and add the following to your `.rubocop.yml`:

```yaml
inherit_gem:
pundit: config/rubocop-rspec.yml
```
# External Resources
- [RailsApps Example Application: Pundit and Devise](https://github.com/RailsApps/rails-devise-pundit)
Expand Down
5 changes: 5 additions & 0 deletions config/rubocop-rspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
RSpec:
Language:
ExampleGroups:
Regular:
- permissions

0 comments on commit a5d756a

Please sign in to comment.