Sha256: 036f8cdb416b521db79b801af8503fa9b9054a66e4c6a9a6f0b686d316989393

Contents?: true

Size: 1.22 KB

Versions: 10

Compression:

Stored size: 1.22 KB

Contents

require 'pact_broker/matrix/row'

module PactBroker
  module Matrix
    describe Row do
      describe "<=>" do
        let(:row_1) do
          Row.new(
            consumer_name: 'A',
            consumer_version_order: 1,
            pact_revision_number: 1,
            provider_name: 'B',
            provider_version_order: 1,
            verification_id: 1
          )
        end
        let(:row_2) do
          Row.new(
            consumer_name: 'A',
            consumer_version_order: 1,
            pact_revision_number: 1,
            provider_name: 'B',
            provider_version_order: 1,
            verification_id: 2
          )
        end

        it "sorts" do
          expect([row_1, row_2].sort).to eq [row_2, row_1]
        end

        context "with a nil column" do
          let(:row_2) do
            Row.new(
              consumer_name: 'A',
              consumer_version_order: 1,
              pact_revision_number: 1,
              provider_name: 'B',
              provider_version_order: nil,
              verification_id: nil
            )
          end

          it "sorts the rows first" do
            expect([row_1, row_2].sort).to eq [row_2, row_1]
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
pact_broker-2.15.0 spec/lib/pact_broker/matrix/row_spec.rb
pact_broker-2.14.0 spec/lib/pact_broker/matrix/row_spec.rb
pact_broker-2.13.1 spec/lib/pact_broker/matrix/row_spec.rb
pact_broker-2.13.0 spec/lib/pact_broker/matrix/row_spec.rb
pact_broker-2.12.0 spec/lib/pact_broker/matrix/row_spec.rb
pact_broker-2.11.0 spec/lib/pact_broker/matrix/row_spec.rb
pact_broker-2.10.0 spec/lib/pact_broker/matrix/row_spec.rb
pact_broker-2.9.0 spec/lib/pact_broker/matrix/row_spec.rb
pact_broker-2.9.0.beta.5 spec/lib/pact_broker/matrix/row_spec.rb
pact_broker-2.8.0.beta.5 spec/lib/pact_broker/matrix/row_spec.rb