Welcome to mirror list, hosted at ThFree Co, Russian Federation.

spec_helpers.rb « rubocop - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a702a083958a16043cbc7cb4870b20e38a399324 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
module RuboCop
  module SpecHelpers
    SPEC_HELPERS = %w[spec_helper.rb rails_helper.rb].freeze

    # Returns true if the given node originated from the spec directory.
    def in_spec?(node)
      path = node.location.expression.source_buffer.name

      !SPEC_HELPERS.include?(File.basename(path)) && path.start_with?(File.join(Dir.pwd, 'spec'))
    end
  end
end