Sha256: b786cbee108a01f8eb8d294e6cfb82b939cfb122294934e1e3529616b1b9b9f3

Contents?: true

Size: 1.25 KB

Versions: 76

Compression:

Stored size: 1.25 KB

Contents

require 'pact_broker/domain/version'

module PactBroker

  module Domain

    describe Version do
      describe "#latest_pact_publication" do
        let!(:pact) do
          TestDataBuilder.new
            .create_consumer
            .create_provider
            .create_consumer_version
            .create_pact
            .revise_pact
            .and_return(:pact)
        end
        let(:version) { Version.order(:id).last }

        it "returns the latest pact revision for the consumer version" do
          expect(version.latest_pact_publication.id).to eq pact.id
        end
      end

      describe "uq_ver_ppt_ord" do
        let(:consumer) do
          TestDataBuilder.new
            .create_consumer
            .and_return(:consumer)
        end

        it "does not allow two versions with the same pacticipant and order" do
          Sequel::Model.db[:versions].insert(number: '1', order: 0, pacticipant_id: consumer.id, created_at: DateTime.new(2017), updated_at: DateTime.new(2017))
          expect { Sequel::Model.db[:versions].insert(number: '2', order: 0, pacticipant_id: consumer.id, created_at: DateTime.new(2017), updated_at: DateTime.new(2017)) }
            .to raise_error(Sequel::UniqueConstraintViolation)
        end
      end
    end
  end
end

Version data entries

76 entries across 76 versions & 1 rubygems

Version Path
pact_broker-2.50.1 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.50.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.49.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.48.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.47.1 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.47.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.46.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.45.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.44.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.43.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.42.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.41.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.40.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.39.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.38.1 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.38.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.37.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.36.1 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.36.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.35.0 spec/lib/pact_broker/domain/version_spec.rb