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.66.1 lib/pact/provider/pact_helper_locator.rb
pact-1.66.0 lib/pact/provider/pact_helper_locator.rb
pact-1.65.3 lib/pact/provider/pact_helper_locator.rb
pact-1.65.2 lib/pact/provider/pact_helper_locator.rb
pact-1.65.1 lib/pact/provider/pact_helper_locator.rb
pact-1.65.0 lib/pact/provider/pact_helper_locator.rb
pact-1.64.0 lib/pact/provider/pact_helper_locator.rb
pact-1.63.0 lib/pact/provider/pact_helper_locator.rb
pact-1.62.0 lib/pact/provider/pact_helper_locator.rb
pact-1.61.0 lib/pact/provider/pact_helper_locator.rb
pact-1.60.0 lib/pact/provider/pact_helper_locator.rb
pact-1.59.0 lib/pact/provider/pact_helper_locator.rb
pact-1.58.0 lib/pact/provider/pact_helper_locator.rb
pact-1.57.0 lib/pact/provider/pact_helper_locator.rb
pact-1.56.0 lib/pact/provider/pact_helper_locator.rb
pact-1.55.7 lib/pact/provider/pact_helper_locator.rb
pact-1.55.6 lib/pact/provider/pact_helper_locator.rb
pact-1.55.5 lib/pact/provider/pact_helper_locator.rb
pact-1.55.4 lib/pact/provider/pact_helper_locator.rb
pact-1.55.3 lib/pact/provider/pact_helper_locator.rb