Sha256: 2f4ffbd3453eab9221c93d906ec5fdc15e6efa933390074ece8bb4a042c210e9

Contents?: true

Size: 912 Bytes

Versions: 44

Compression:

Stored size: 912 Bytes

Contents

module Pact
  module Provider
    module PactHelperLocater
      PACT_HELPER_FILE_PATTERNS = [
        "spec/**/*service*consumer*/pact_helper.rb",
        "spec/**/*consumer*/pact_helper.rb",
        "spec/**/pact_helper.rb",
        "test/**/*service*consumer*/pact_helper.rb",
        "test/**/*consumer*/pact_helper.rb",
        "test/**/pact_helper.rb",
        "**/pact_helper.rb"
      ]

      NO_PACT_HELPER_FOUND_MSG = "Please create a pact_helper.rb file that can be found using one of the following patterns: #{PACT_HELPER_FILE_PATTERNS.join(", ")}"

      def self.pact_helper_path
        pact_helper_search_results = []
        PACT_HELPER_FILE_PATTERNS.find { | pattern | (pact_helper_search_results.concat(Dir.glob(pattern))).any? }
        raise NO_PACT_HELPER_FOUND_MSG if pact_helper_search_results.empty?
        File.join(Dir.pwd, pact_helper_search_results[0])
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
pact-1.55.2 lib/pact/provider/pact_helper_locator.rb
pact-1.55.1 lib/pact/provider/pact_helper_locator.rb
pact-1.55.0 lib/pact/provider/pact_helper_locator.rb
pact-1.54.0 lib/pact/provider/pact_helper_locator.rb
pact-1.53.0 lib/pact/provider/pact_helper_locator.rb
pact-1.52.0 lib/pact/provider/pact_helper_locator.rb
pact-1.51.1 lib/pact/provider/pact_helper_locator.rb
pact-1.51.0 lib/pact/provider/pact_helper_locator.rb
pact-1.50.1 lib/pact/provider/pact_helper_locator.rb
pact-1.50.0 lib/pact/provider/pact_helper_locator.rb
pact-1.49.3 lib/pact/provider/pact_helper_locator.rb
pact-1.49.2 lib/pact/provider/pact_helper_locator.rb
pact-1.49.1 lib/pact/provider/pact_helper_locator.rb
pact-1.49.0 lib/pact/provider/pact_helper_locator.rb
pact-1.48.0 lib/pact/provider/pact_helper_locator.rb
pact-1.47.0 lib/pact/provider/pact_helper_locator.rb
pact-1.46.1 lib/pact/provider/pact_helper_locator.rb
pact-1.46.0 lib/pact/provider/pact_helper_locator.rb
pact-1.45.0 lib/pact/provider/pact_helper_locator.rb
pact-1.44.1 lib/pact/provider/pact_helper_locator.rb