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.34.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.33.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.32.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.31.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.30.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.29.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.27.6 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.27.5 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.27.4 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.27.3 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.27.2 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.27.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.26.1 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.26.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.25.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.24.0 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.23.4 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.23.3 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.23.2 spec/lib/pact_broker/domain/version_spec.rb
pact_broker-2.23.1 spec/lib/pact_broker/domain/version_spec.rb