From 69dbc5a5270a2b00bc2e359af37d6176748db400 Mon Sep 17 00:00:00 2001 From: Vitali Tatarintev Date: Wed, 28 Aug 2019 08:48:14 +0200 Subject: Remove Rubocop::SpecHelper file --- rubocop/cop/rspec/be_success_matcher.rb | 4 ---- rubocop/spec_helpers.rb | 30 ------------------------------ 2 files changed, 34 deletions(-) delete mode 100644 rubocop/spec_helpers.rb (limited to 'rubocop') diff --git a/rubocop/cop/rspec/be_success_matcher.rb b/rubocop/cop/rspec/be_success_matcher.rb index 07dad061613..dce9604b3d7 100644 --- a/rubocop/cop/rspec/be_success_matcher.rb +++ b/rubocop/cop/rspec/be_success_matcher.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative '../../spec_helpers' - module RuboCop module Cop module RSpec @@ -24,8 +22,6 @@ module RuboCop # it { is_expected.to be_successful } # class BeSuccessMatcher < RuboCop::Cop::Cop - include SpecHelpers - MESSAGE = 'Do not use deprecated `success?` method, use `successful?` instead.' def_node_search :expect_to_be_success?, <<~PATTERN diff --git a/rubocop/spec_helpers.rb b/rubocop/spec_helpers.rb deleted file mode 100644 index ecd77c4351d..00000000000 --- a/rubocop/spec_helpers.rb +++ /dev/null @@ -1,30 +0,0 @@ -module RuboCop - module SpecHelpers - SPEC_HELPERS = %w[fast_spec_helper.rb rails_helper.rb spec_helper.rb].freeze - MIGRATION_SPEC_DIRECTORIES = ['spec/migrations', 'spec/lib/gitlab/background_migration'].freeze - - # Returns true if the given node originated from the spec directory. - def in_spec?(node) - path = node.location.expression.source_buffer.name - pwd = RuboCop::PathUtil.pwd - - !SPEC_HELPERS.include?(File.basename(path)) && - path.start_with?(File.join(pwd, 'spec'), File.join(pwd, 'ee', 'spec')) - end - - def migration_directories - @migration_directories ||= MIGRATION_SPEC_DIRECTORIES.map do |dir| - pwd = RuboCop::PathUtil.pwd - [File.join(pwd, dir), File.join(pwd, 'ee', dir)] - end.flatten - end - - # Returns true if the given node originated from a migration spec. - def in_migration_spec?(node) - path = node.location.expression.source_buffer.name - - in_spec?(node) && - path.start_with?(*migration_directories) - end - end -end -- cgit v1.2.3