Sha256: 08d373dc29ce594194cf71e2bf747570dcd9d10fa3115e75319ea76cea18c0d0

Contents?: true

Size: 1.17 KB

Versions: 5

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

require 'appmap/service/test_framework_detector'

module AppMap
  module Service
    class IntegrationTestPathFinder
      class << self
        def find
          @paths ||= begin
            paths = { rspec: [], minitest: [], cucumber: [] }
            paths[:rspec] = find_rspec_paths if TestFrameworkDetector.rspec_present?
            paths[:minitest] = find_minitest_paths if TestFrameworkDetector.minitest_present?
            paths[:cucumber] = find_cucumber_paths if TestFrameworkDetector.cucumber_present?
            paths
          end
        end

        def count_paths
          find.flatten(2).length - 3
        end

        private

        def find_rspec_paths
          find_non_empty_paths(%w[spec/controllers spec/requests spec/integration spec/api spec/features spec/system])
        end


        def find_minitest_paths
          find_non_empty_paths(%w[test/controllers test/integration])
        end

        def find_cucumber_paths
          find_non_empty_paths(%w[features])
        end

        def find_non_empty_paths(paths)
          paths.select { |path| Dir.exist?(path) && !Dir.empty?(path) }
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
appmap-0.60.0 lib/appmap/service/integration_test_path_finder.rb
appmap-0.59.2 lib/appmap/service/integration_test_path_finder.rb
appmap-0.59.1 lib/appmap/service/integration_test_path_finder.rb
appmap-0.59.0 lib/appmap/service/integration_test_path_finder.rb
appmap-0.58.0 lib/appmap/service/integration_test_path_finder.rb