Sha256: f56b3a6bf19da9c3d6ec64d5504d864840e1da585ceca6490a98c70ce891cf28

Contents?: true

Size: 1.26 KB

Versions: 3

Compression:

Stored size: 1.26 KB

Contents

require 'pact/provider/proxy/task_helper'

module Pact
  module Provider
    module Proxy
      describe TaskHelper do

        include TaskHelper

        let(:pact_helper) { './pact_helper.rb' }
        let(:pact_uri) { 'http://pact.com/pact.json' }
        let(:command) { verify_command pact_helper, pact_uri }

        before do
          allow(ENV).to receive(:[]).with('PACT_DESCRIPTION').and_return('desc ription')
          allow(ENV).to receive(:[]).with('PACT_PROVIDER_STATE').and_return('state')
          allow(ENV).to receive(:[]).with('BACKTRACE').and_return('true')
        end

        describe "#verify_command" do
          context "when the PACT_DESCRIPTION is set" do
            it "includes the --description option" do
              expect(command).to include " --description desc\\ ription "
            end
          end

          context "when the PACT_PROVIDER_STATE is set" do
            it "includes the --provider-state option" do
              expect(command).to include " --provider-state state "
            end
          end

          context "when the BACKTRACE is set" do
            it "includes the --backtrace option" do
              expect(command).to include " --backtrace"
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pact-provider-proxy-2.3.0 spec/lib/pact/provider/proxy/task_helper_spec.rb
pact-provider-proxy-2.2.0 spec/lib/pact/provider/proxy/task_helper_spec.rb
pact-provider-proxy-2.1.0 spec/lib/pact/provider/proxy/task_helper_spec.rb