Sha256: dad62211df2d2eaa0965fe21f19a347f2f109c012112fb085ecdd56f1e30e528

Contents?: true

Size: 1.68 KB

Versions: 20

Compression:

Stored size: 1.68 KB

Contents

require 'pact_broker/api/decorators/tag_decorator'
require 'pact_broker/tags/repository'

require 'support/provider_state_builder'

module PactBroker

  module Api

    module Decorators

      describe TagDecorator do

        let(:tag) do
          ProviderStateBuilder.new
            .create_consumer("Consumer")
            .create_version("1.2.3")
            .create_tag("prod")
          PactBroker::Tags::Repository.new.find tag_name: 'prod', pacticipant_version_number: '1.2.3', pacticipant_name: 'Consumer'
        end

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

        subject { JSON.parse TagDecorator.new(tag).to_json(options), symbolize_names: true }

        it "includes the tag name" do
          expect(subject[:name]).to eq "prod"
        end

        it "includes a link to itself" do
          expect(subject[:_links][:self][:href]).to eq "http://example.org/pacticipants/Consumer/versions/1.2.3/tags/prod"
        end

        it "includes the tag name" do
          expect(subject[:_links][:self][:name]).to eq "prod"
        end

        it "includes a link to the version" do
          expect(subject[:_links][:version][:href]).to eq "http://example.org/pacticipants/Consumer/versions/1.2.3"
        end

        it "includes the version number" do
          expect(subject[:_links][:version][:name]).to eq "1.2.3"
        end

        it "includes a link to the pacticipant" do
          expect(subject[:_links][:pacticipant][:href]).to eq "http://example.org/pacticipants/Consumer"
        end

        it "includes the pacticipant name" do
          expect(subject[:_links][:pacticipant][:name]).to eq "Consumer"
        end

      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
pact_broker-2.0.5 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.0.4 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.0.3 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.0.2 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.0.1 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.0.0 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.0.0.beta.8 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.0.0.beta.7 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.0.0.beta.6 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-1.18.0 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.0.0.beta.5 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-1.18.0.beta.1 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-1.17.2 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-1.17.1 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.0.0.beta.4 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.0.0.beta.3 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.0.0.beta.2 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.0.0.beta.1 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-1.17.0 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-1.16.0 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb