Sha256: e0f418440a365832a9fd6667e8caef5019a70587fe8fdd0518379a379e726cec

Contents?: true

Size: 1.55 KB

Versions: 5

Compression:

Stored size: 1.55 KB

Contents

require 'pact_broker/matrix/head_row'

module PactBroker
  module Matrix
    describe HeadRow do
      describe "refresh", migration: true do
        before do
          PactBroker::Database.migrate
        end

        let(:td) { TestDataBuilder.new(auto_refresh_matrix: false) }

        before do
          td.create_pact_with_hierarchy("Foo", "1", "Bar")
        end

        context "with a consumer pacticipant_id and a consumer tag_name" do
          before do
            td.create_consumer_version_tag("prod")
            Row.refresh(ids)
          end
          let(:ids) { { pacticipant_id: td.consumer.id, tag_name: "prod"} }

          subject { HeadRow.refresh(ids) }

          it "refreshes the data for the consumer and consumer tag in the head matrix" do
            subject
            expect(HeadRow.all.collect(&:values)).to contain_hash(provider_name: "Bar", consumer_name: "Foo", consumer_version_tag_name: "prod")
          end
        end

        context "with a provider pacticipant_id and a provider tag_name" do
          before do
            td.create_verification(provider_version: "2")
              .use_provider_version("2")
              .create_provider_version_tag("prod")
            Row.refresh(ids)
          end

          let(:ids) { { pacticipant_id: td.consumer.id, tag_name: "prod" } }

          subject { HeadRow.refresh(ids) }

          it "does not update the head matrix as the head matrix only contains consumer tags" do
            subject
            expect(HeadRow.count).to eq 0
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pact_broker-2.19.1 spec/lib/pact_broker/matrix/head_row_spec.rb
pact_broker-2.19.0 spec/lib/pact_broker/matrix/head_row_spec.rb
pact_broker-2.18.0 spec/lib/pact_broker/matrix/head_row_spec.rb
pact_broker-2.17.1 spec/lib/pact_broker/matrix/head_row_spec.rb
pact_broker-2.17.0 spec/lib/pact_broker/matrix/head_row_spec.rb