Sha256: c3499fe5ac4f95c96981c12d452d60a64f9724c93e86667ae52542554f6e7bbb

Contents?: true

Size: 1.07 KB

Versions: 10

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

require_relative 'rails_awareness'

module SimpleCov::Formatter::Terminal::SpecToAppMapping
  # rubocop:disable Lint/OrAssignmentToConstant
  DEFAULT_UNMAPPABLE_SPEC_REGEXES ||= [
    %r{\Aspec/features/},
  ].freeze
  SPEC_TO_GEM_DEFAULT_MAP ||= {
    %r{\Aspec/} => 'lib/',
  }.freeze
  SPEC_TO_RAILS_DEFAULT_MAP ||= {
    %r{\Aspec/lib/} => 'lib/',
    %r{\Aspec/controllers/admin/(.*)_controller_spec.rb} => 'app/admin/\1.rb',
    %r{
      \Aspec/
      (
      actions|
      channels|
      controllers|
      decorators|
      helpers|
      mailboxes|
      mailers|
      models|
      policies|
      serializers|
      views|
      workers
      )
      /
    }x => 'app/\1/',
  }.freeze
  # rubocop:enable Lint/OrAssignmentToConstant

  class << self
    def default_spec_to_app_map
      # dup the maps because the maps are frozen but we want to allow the user to customize them
      if SimpleCov::Formatter::Terminal::RailsAwareness.rails?
        SPEC_TO_RAILS_DEFAULT_MAP.dup
      else
        SPEC_TO_GEM_DEFAULT_MAP.dup
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
simple_cov-formatter-terminal-1.7.0 lib/simple_cov/formatter/terminal/spec_to_app_mapping.rb
simple_cov-formatter-terminal-1.6.0 lib/simple_cov/formatter/terminal/spec_to_app_mapping.rb
simple_cov-formatter-terminal-1.5.0 lib/simple_cov/formatter/terminal/spec_to_app_mapping.rb
simple_cov-formatter-terminal-1.4.0 lib/simple_cov/formatter/terminal/spec_to_app_mapping.rb
simple_cov-formatter-terminal-1.3.0 lib/simple_cov/formatter/terminal/spec_to_app_mapping.rb
simple_cov-formatter-terminal-1.2.0 lib/simple_cov/formatter/terminal/spec_to_app_mapping.rb
simple_cov-formatter-terminal-1.1.0 lib/simple_cov/formatter/terminal/spec_to_app_mapping.rb
simple_cov-formatter-terminal-1.0.0 lib/simple_cov/formatter/terminal/spec_to_app_mapping.rb
simple_cov-formatter-terminal-0.3.1 lib/simple_cov/formatter/terminal/spec_to_app_mapping.rb
simple_cov-formatter-terminal-0.3.0 lib/simple_cov/formatter/terminal/spec_to_app_mapping.rb