Sha256: d812f2f5928951bfbdeb4bef8893389fcfa4b1b0b1eb6d8b5784072527d55c59

Contents?: true

Size: 661 Bytes

Versions: 7

Compression:

Stored size: 661 Bytes

Contents

RSpec.describe 'Project requires' do
  it 'alphabetizes cop requires' do
    source   = SpecHelper::ROOT.join('lib', 'rubocop', 'cop', 'rspec_cops.rb')
    captures = source.read.scan(%r{^(require_relative 'rspec/(.*?/)?(.*?)')$})

    require_statements = captures.map(&:first)
    sorted_require_statements =
      captures.sort_by do |_require_statement, cop_category, name|
        [cop_category || 'rspec', name]
      end.map(&:first)

    aggregate_failures do
      # Sanity check that we actually discovered require statements.
      expect(captures).not_to be_empty
      expect(require_statements).to eql(sorted_require_statements)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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