Sha256: 67baef9e8eeb7e395bc216acf6d5f4132ff7e409c11a05e2274ebd6af356b597

Contents?: true

Size: 1.17 KB

Versions: 115

Compression:

Stored size: 1.17 KB

Contents

require 'pact_broker/api/decorators/label_decorator'

module PactBroker
  module Api
    module Decorators

      describe LabelDecorator do

        let(:label) do
          TestDataBuilder.new
            .create_consumer("Consumer")
            .create_label("ios")
            .and_return(:label)
        end

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

        subject { JSON.parse LabelDecorator.new(label).to_json(options), symbolize_names: true }

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

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

        it "includes the label name" do
          expect(subject[:_links][:self][:name]).to eq "ios"
        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

115 entries across 115 versions & 1 rubygems

Version Path
pact_broker-2.79.1 spec/lib/pact_broker/api/decorators/label_decorator_spec.rb
pact_broker-2.79.0 spec/lib/pact_broker/api/decorators/label_decorator_spec.rb
pact_broker-2.78.1 spec/lib/pact_broker/api/decorators/label_decorator_spec.rb
pact_broker-2.78.0 spec/lib/pact_broker/api/decorators/label_decorator_spec.rb
pact_broker-2.77.0 spec/lib/pact_broker/api/decorators/label_decorator_spec.rb
pact_broker-2.76.2 spec/lib/pact_broker/api/decorators/label_decorator_spec.rb
pact_broker-2.76.1 spec/lib/pact_broker/api/decorators/label_decorator_spec.rb
pact_broker-2.76.0 spec/lib/pact_broker/api/decorators/label_decorator_spec.rb
pact_broker-2.75.0 spec/lib/pact_broker/api/decorators/label_decorator_spec.rb
pact_broker-2.74.1 spec/lib/pact_broker/api/decorators/label_decorator_spec.rb
pact_broker-2.74.0 spec/lib/pact_broker/api/decorators/label_decorator_spec.rb
pact_broker-2.73.0 spec/lib/pact_broker/api/decorators/label_decorator_spec.rb
pact_broker-2.72.0 spec/lib/pact_broker/api/decorators/label_decorator_spec.rb
pact_broker-2.71.0 spec/lib/pact_broker/api/decorators/label_decorator_spec.rb
pact_broker-2.70.0 spec/lib/pact_broker/api/decorators/label_decorator_spec.rb
pact_broker-2.69.0 spec/lib/pact_broker/api/decorators/label_decorator_spec.rb
pact_broker-2.68.1 spec/lib/pact_broker/api/decorators/label_decorator_spec.rb
pact_broker-2.68.0 spec/lib/pact_broker/api/decorators/label_decorator_spec.rb
pact_broker-2.67.0 spec/lib/pact_broker/api/decorators/label_decorator_spec.rb
pact_broker-2.66.0 spec/lib/pact_broker/api/decorators/label_decorator_spec.rb