Sha256: 77d058a5512d44cadfa158c3ea24d1c4fb55ef51e48d94d993b15b5e1869a747

Contents?: true

Size: 627 Bytes

Versions: 1

Compression:

Stored size: 627 Bytes

Contents

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

  it 'flags `let` after the first different node ' do
    expect_violation(<<-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_violations(<<-RUBY)
      RSpec.describe User do
        subject { User }

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubocop-rspec-1.14.0 spec/rubocop/cop/rspec/scattered_let_spec.rb