Sha256: 7ed364edd12d23f77942e574d5b81d2ea9ad75f9b562308683679728dcf67db4

Contents?: true

Size: 1.73 KB

Versions: 10

Compression:

Stored size: 1.73 KB

Contents

require 'pact_broker/api/decorators/verification_decorator'

module PactBroker
  module Api
    module Decorators
      describe VerificationDecorator do

        let(:verification) do
          instance_double('PactBroker::Domain::Verification',
            number: 1,
            success: true,
            provider_version_number: "4.5.6",
            provider_name: 'Provider',
            consumer_name: 'Consumer',
            build_url: 'http://build-url',
            pact_version_sha: '1234',
            latest_pact_publication: pact_publication,
            execution_date: DateTime.now)
        end

        let(:pact_publication) do
          instance_double('PactBroker::Pacts::PactPublication',
            name: 'A name',
            provider_name: 'Provider',
            consumer_name: 'Consumer',
            consumer_version_number: '1.2.3'
          )
        end

        let(:options) { { user_options: { base_url: 'http://example.org' } } }

        subject { JSON.parse VerificationDecorator.new(verification).to_json(options), symbolize_names: true }

        it "includes the success status" do
          expect(subject[:success]).to eq true
        end

        it "includes the provider version" do
          expect(subject[:providerApplicationVersion]).to eq "4.5.6"
        end

        it "includes the build URL" do
          expect(subject[:buildUrl]).to eq "http://build-url"
        end

        it "includes a link to itself" do
          expect(subject[:_links][:self][:href]).to match %r{http://example.org/.*/verification-results/1}
        end

        it "includes a link to its pact" do
          expect(subject[:_links][:'pb:pact-version'][:href]).to match %r{http://example.org/pacts/}
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
pact_broker-2.12.0 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.11.0 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.10.0 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.9.0 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.9.0.beta.5 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.8.0.beta.5 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.8.0.beta.4 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.7.0.beta.3 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.7.0.beta.2 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.7.0.beta.1 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb