Sha256: df9972ccfd6e80901756095577d264430d507e8054630226867288d9dd698dc4

Contents?: true

Size: 654 Bytes

Versions: 4

Compression:

Stored size: 654 Bytes

Contents

# frozen_string_literal: true

RSpec.describe RuboCop::Cop::RSpec::ScatteredLet do
  subject(:cop) { described_class.new }

  it 'flags `let` after the first different node ' do
    expect_offense(<<-RUBY)
      RSpec.describe User do
        let(:a) { a }
        subject { User }
        let(:b) { b }
        ^^^^^^^^^^^^^ Group all let/let! blocks in the example group together.
      end
    RUBY
  end

  it 'doesnt flag `let!` in the middle of multiple `let`s' do
    expect_no_offenses(<<-RUBY)
      RSpec.describe User do
        subject { User }

        let(:a) { a }
        let!(:b) { b }
        let(:c) { c }
      end
    RUBY
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-rspec-1.35.0 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.34.1 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.34.0 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.33.0 spec/rubocop/cop/rspec/scattered_let_spec.rb