rubocop-rspec icon indicating copy to clipboard operation
rubocop-rspec copied to clipboard

Code style checking for RSpec files

Results 163 rubocop-rspec issues
Sort by recently updated
recently updated
newest added

I have a spec that is exercising a DSL of its own: ```ruby let(:actor_class) do Class.new do extend AdheresToPolicy::ClassMethods set_policy do given { |actor| actor == "allowed actor" || actor.is_a?(user_class)...

This PR introduces a new cop: `RSpec/LeadingLet`. `LeadingLet` has grown out of a desire to place all `let` and `let!` above other blocks in spec setup in order use these...

I have the following factory: ```ruby FactoryBot.define do factory :feature_tier, class: 'Services::FeatureTier' do feature { create(:feature) } tier { create(:tier) } end ``` and I'm getting a false positive (I...

bug

## Overview When writing Rails request specs, it'd be handy to auto-correct/enforce the "be_" syntax since it's shorter and easier to read instead of the existing `have_http_status` syntax. ## Desired...

Solves #1087 by moving all dynamic attributes out of the `create` call and into a block This is the first step: tests passing after @pirj confirms that this is a...

I'm seeing double/instance_double/class_double/object_double/spy etc. being called with sometimes a string, sometimes a symbol (perhaps because the rspec-mocks documentation explicitly allows both), and of course sometimes a constant referring to a...

enhancement
cop
good first issue

When running rubocop the RSpec/DescribedClass cop is throwing an error as it tries to collapse the namespace. -------- ## Expected behavior Expect Rubocop to parse through files and not throw...

No auto-correction at this point since MoveNode doesn't play nicely with each_cons Some people may prefer `around` hooks to be before `before` hooks, so making it configurable would also be...

I'm working on a code base that tests ActiveJobs with `assert_enqued_job`, `assert_enqueued_with`, etc, included by the ActiveJob::TestHelper, which is written with minitest. rpsec-rails however provide `have_enqueued_job` matcher

enhancement
cop
help wanted

```ruby # bad expect(foo).to be(0) expect(foo).to equal(0) # good expect(foo).to eq(0) expect(foo).to eql(0) ``` Error message are overly complex, e.g.: ```sh expected # => 0 got # => 1797 ```...

enhancement
cop