Sha256: fdb853d4b3a0c1eb6ae4950ff45f0d5efa93cc2250628e969afc1ea9b620b464
Contents?: true
Size: 1.53 KB
Versions: 9
Compression:
Stored size: 1.53 KB
Contents
require 'spec_helper' require 'pact/provider/pact_helper_locator' module Pact::Provider describe PactHelperLocater do describe "pact_helper_path", :fakefs => true do subject { PactHelperLocater.pact_helper_path } def make_pactfile dir FileUtils.mkdir_p ".#{dir}" FileUtils.touch ".#{dir}/pact_helper.rb" end PACT_HELPER_FILE_DIRS = [ '/spec/blah/service-consumers', '/spec/consumers', '/spec/blah/service_consumers', '/spec/serviceconsumers', '/spec/consumer', '/spec', '/blah', '/blah/consumer', '' ] PACT_HELPER_FILE_DIRS.each do | dir | context "the pact_helper is stored in #{dir}" do it "finds the pact_helper" do make_pactfile dir expect(subject).to eq File.join(Dir.pwd, dir, 'pact_helper.rb') end end end context "when more than one pact_helper exists" do it "returns the one that matches the most explict search pattern" do make_pactfile '/spec/consumer' FileUtils.touch 'pact_helper.rb' expect(subject).to eq File.join(Dir.pwd, '/spec/consumer/pact_helper.rb') end end context "when a file exists ending in pact_helper.rb" do it "is not identifed as a pact helper" do FileUtils.mkdir_p './spec' FileUtils.touch './spec/not_pact_helper.rb' expect { subject }.to raise_error /Please create a pact_helper.rb file/ end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems