rubocop-rspec
rubocop-rspec copied to clipboard
Code style checking for RSpec files
Our TODO file mentioned that the `DescribedClass` class was too long. Looking closer at it, I found a couple of methods (`#full_const_name`, `#collapse_namespace`, `#const_name`, and `#namespace`) working on the isolated...
We checked some new cops/significant changes against the repos we're working on to make sure there are no errors. I thought of adding a couple of well-known OS repos and...
The cop introduced in #994 lacks the ability to detect includes with identical blocks: ```ruby it_behaves_like 'a foo' do let(:x) { 1 } end it_behaves_like 'a foo' do let(:x) {...
This issue produces false positives of Rspec/LetSetup with the latest rubocop-rspec (1.36.0) when we put `let!` inside some context and we also have `shared_examples` referencing that `let!` outside the context....
There is [`parent_module_name` in `rubocop-ast`](https://github.com/rubocop-hq/rubocop-ast/blob/e2df776f6aa4133413e2de0e20b4a3295b12988f/lib/rubocop/ast/node.rb#L333), which seems to do the same as the `namespace` method from `RSpec/DescribedClass`. **WARNING**: `parent_module_name` is used only by the `DuplicateMethods` cop and seems to be...
I have rebased #245 on master, added changelog and cleaned up a bit the code (e.g. applied my own feedback from the original pull request). I'm happy with this version...
Imagine the code: ```ruby expect(parser.handles?('string')).to be_truthy ``` `RSpec/PredicateMatcher` will suggest to change this into: ```ruby expect(parser).to be_handles('string') ``` ...which reads pretty unnatural, to say the least. Maybe there could be...
```ruby FactoryBot.define do factory :user trait :active do status { 'active' } do trait :inactive do status 'inactive' do end ``` This allows for an undefined behaviour when being called...
I'm working on a code base where I have both styles of using factory: `create(:user, name: 'John')` and `create :user, name: 'John;` it will be good if one of those...
While reviewing one of the pull requests I've looked at this cop, and noticed incorrect and incomplete behaviour: 1. It misses inside methods, only catches inside examples (blocks): ```ruby expect_offense(