Sha256: 914b1476fb6d7a4ea736c8e9be12d29d60f8384c883e6f3c3ded882a525c58de

Contents?: true

Size: 623 Bytes

Versions: 7

Compression:

Stored size: 623 Bytes

Contents

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

7 entries across 7 versions & 1 rubygems

Version Path
rubocop-rspec-1.32.0 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.31.0 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.30.1 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.30.0 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.29.1 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.29.0 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.28.0 spec/rubocop/cop/rspec/scattered_let_spec.rb