Sha256: 1c20c774bab1db2c3addf96fb69ee79411dcdff095d2a56e612e1043029e65e9

Contents?: true

Size: 1.56 KB

Versions: 6

Compression:

Stored size: 1.56 KB

Contents

require "pactflow/client/cli/pactflow"

RSpec.describe "publish-provider-contract" do
  let(:index_body_hash) do
    {
      _links: {
        "pf:publish-provider-contract" => {
          href: "http://broker/some-publish/{provider}"
        }
      }
    }
  end

  let(:post_response_body) do
      {
        "notices"=>[{"text"=>"some notice", "type"=>"info"}, {"text"=>"some other notice", "type"=>"info"}]
      }
  end

  let!(:index_request) do
    stub_request(:get, "http://broker").to_return(status: 200, body: index_body_hash.to_json, headers: { "Content-Type" => "application/hal+json" }  )
  end

  let!(:publish_request) do
    stub_request(:post, "http://broker/some-publish/Bar").to_return(status: 200, body: post_response_body.to_json, headers: { "Content-Type" => "application/hal+json" }  )
  end

  let(:parameters) do
    %w{
      publish-provider-contract
      script/oas.yml
      --provider Bar
      --broker-base-url http://broker
      --provider-app-version 1013b5650d61214e19f10558f97fb5a3bb082d44
      --branch main
      --tag dev
      --specification oas
      --content-type application/yml
      --verification-exit-code 0
      --verification-results script/verification-results.txt
      --verification-results-content-type text/plain
      --verification-results-format text
      --verifier my-custom-tool
      --verifier-version "1.0"
    }
  end

  subject { capture(:stdout) { Pactflow::Client::CLI::Pactflow.start(parameters) } }

  it "prints the notices" do
    Approvals.verify(subject, :name => "publish_provider_contract", format: :txt)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pact_broker-client-1.75.3 spec/integration/publish_provider_contract_spec.rb
pact_broker-client-1.75.1 spec/integration/publish_provider_contract_spec.rb
pact_broker-client-1.75.0 spec/integration/publish_provider_contract_spec.rb
pact_broker-client-1.74.0 spec/integration/publish_provider_contract_spec.rb
pact_broker-client-1.73.0 spec/integration/publish_provider_contract_spec.rb
pact_broker-client-1.72.0 spec/integration/publish_provider_contract_spec.rb