Skip to content

Commit

Permalink
Merge pull request #1080 from rubocop-hq/spec-helper-cleanup
Browse files Browse the repository at this point in the history
Clean up our spec helper
  • Loading branch information
pirj committed Nov 9, 2020
2 parents c76bb59 + 0969740 commit c7569e9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require 'rubocop'

require 'rubocop/rspec/support'

if ENV['COVERAGE'] == 'true'
Expand All @@ -14,16 +13,17 @@ module SpecHelper
end

spec_helper_glob = File.expand_path('{support,shared}/*.rb', __dir__)
Dir.glob(spec_helper_glob).map(&method(:require))
Dir.glob(spec_helper_glob).sort.each(&method(:require))

RSpec.configure do |config|
# Set metadata so smoke tests are run on all cop specs
config.define_derived_metadata(file_path: %r{/spec/rubocop/cop/}) do |meta|
meta[:type] = :cop_spec
end

# Include config shared context for all cop specs
config.define_derived_metadata(type: :cop_spec) do |metadata|
metadata[:config] = true
config.define_derived_metadata(type: :cop_spec) do |meta|
meta[:config] = true
end

config.order = :random
Expand All @@ -46,6 +46,5 @@ module SpecHelper
end

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))

require 'rubocop-rspec'

0 comments on commit c7569e9

Please sign in to comment.