Remove Rubocop::SpecHelper file

This commit is contained in:
Vitali Tatarintev 2019-08-28 08:48:14 +02:00
parent 0fee944741
commit 69dbc5a527
3 changed files with 0 additions and 37 deletions

View File

@ -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

View File

@ -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

View File

@ -2,9 +2,6 @@
require 'spec_helper'
require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/rspec/be_success_matcher'
describe RuboCop::Cop::RSpec::BeSuccessMatcher do