Sha256: e9b6e85f0f679d988fa9995f1232749fc18b0b1446f7b122f17c50e952f9bf1a

Contents?: true

Size: 1.18 KB

Versions: 99

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'
require 'pact_broker/api/decorators/versions_decorator'
require 'pact_broker/domain/version'

module PactBroker

  module Api

    module Decorators

      describe VersionsDecorator do

        let(:options) { {base_url: 'http://example.org', pacticipant_name: "Consumer" }}

        subject { JSON.parse VersionsDecorator.new(versions).to_json(user_options: options), symbolize_names: true }

        context "with no versions" do
          let(:versions) { [] }

          it "doesn't blow up" do
            subject
          end
        end

        context "with versions" do
          let(:version) do
            TestDataBuilder.new
              .create_consumer("Consumer")
              .create_consumer_version("1.2.3")
              .create_consumer_version_tag("prod")
            PactBroker::Versions::Repository.new.find_by_pacticipant_name_and_number "Consumer", "1.2.3"
          end
          let(:versions) { [version] }

          it "displays a list of versions" do
            expect(subject[:_embedded][:versions]).to be_instance_of(Array)
            expect(subject[:_embedded][:versions].size).to eq 1
          end
        end

      end
    end
  end
end

Version data entries

99 entries across 99 versions & 1 rubygems

Version Path
pact_broker-2.65.0 spec/lib/pact_broker/api/decorators/versions_decorator_spec.rb
pact_broker-2.64.0 spec/lib/pact_broker/api/decorators/versions_decorator_spec.rb
pact_broker-2.63.0 spec/lib/pact_broker/api/decorators/versions_decorator_spec.rb
pact_broker-2.62.0 spec/lib/pact_broker/api/decorators/versions_decorator_spec.rb
pact_broker-2.61.0 spec/lib/pact_broker/api/decorators/versions_decorator_spec.rb
pact_broker-2.60.1 spec/lib/pact_broker/api/decorators/versions_decorator_spec.rb
pact_broker-2.60.0 spec/lib/pact_broker/api/decorators/versions_decorator_spec.rb
pact_broker-2.59.2 spec/lib/pact_broker/api/decorators/versions_decorator_spec.rb
pact_broker-2.59.1 spec/lib/pact_broker/api/decorators/versions_decorator_spec.rb
pact_broker-2.59.0 spec/lib/pact_broker/api/decorators/versions_decorator_spec.rb
pact_broker-2.58.3 spec/lib/pact_broker/api/decorators/versions_decorator_spec.rb
pact_broker-2.58.2 spec/lib/pact_broker/api/decorators/versions_decorator_spec.rb
pact_broker-2.58.0 spec/lib/pact_broker/api/decorators/versions_decorator_spec.rb
pact_broker-2.57.0 spec/lib/pact_broker/api/decorators/versions_decorator_spec.rb
pact_broker-2.56.1 spec/lib/pact_broker/api/decorators/versions_decorator_spec.rb
pact_broker-2.56.0 spec/lib/pact_broker/api/decorators/versions_decorator_spec.rb
pact_broker-2.55.0 spec/lib/pact_broker/api/decorators/versions_decorator_spec.rb
pact_broker-2.54.0 spec/lib/pact_broker/api/decorators/versions_decorator_spec.rb
pact_broker-2.53.0 spec/lib/pact_broker/api/decorators/versions_decorator_spec.rb
pact_broker-2.52.2 spec/lib/pact_broker/api/decorators/versions_decorator_spec.rb