Sha256: 4f3e9af2ab808b3f837fabf70809c024ce7d3567e71acddbeff098478c51564a

Contents?: true

Size: 1.9 KB

Versions: 15

Compression:

Stored size: 1.9 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',
            test_results: { 'arbitrary' => 'json' },
            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 test results" do
          expect(subject[:testResults]).to eq(arbitrary: 'json')
        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

15 entries across 15 versions & 1 rubygems

Version Path
pact_broker-2.22.0 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.21.0 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.20.0 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.19.2 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.19.1 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.19.0 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.18.0 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.17.1 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.17.0 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.16.1 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.16.0 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.15.0 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.14.0 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.13.1 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb
pact_broker-2.13.0 spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb