Sha256: dd41860f5628a8a849363244781431f7504b0d5ab4147589bc7c6915284553fa

Contents?: true

Size: 1.57 KB

Versions: 12

Compression:

Stored size: 1.57 KB

Contents

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

require "support/test_data_builder"

module PactBroker

  module Api

    module Decorators

      describe TagDecorator do

        let(:tag) do
          TestDataBuilder.new
            .create_consumer("Consumer")
            .create_version("1.2.3")
            .create_tag("prod")
            .and_return(:tag)
        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

12 entries across 12 versions & 1 rubygems

Version Path
pact_broker-2.89.1 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.89.0 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.88.0 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.87.0 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.86.0 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.85.1 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.85.0 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.84.0 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.83.0 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.82.0 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.81.0 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb
pact_broker-2.80.0 spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb