Sha256: 125be26df9f48e1747d50d67fe3b776764a0e7249f7b9c75ae5d5327707bf418

Contents?: true

Size: 800 Bytes

Versions: 16

Compression:

Stored size: 800 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

  it 'does not encounter an error when handling an empty describe' do
    expect { inspect_source('RSpec.describe(User) do end', 'a_spec.rb') }
      .not_to raise_error
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rubocop-rspec-1.27.0 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.26.0 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.25.1 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.25.0 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.24.0 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.23.0 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.22.2 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.22.1 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.22.0 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.21.0 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.20.1 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.20.0 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.19.0 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.18.0 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.17.1 spec/rubocop/cop/rspec/scattered_let_spec.rb
rubocop-rspec-1.17.0 spec/rubocop/cop/rspec/scattered_let_spec.rb