Sha256: 872cfeb1b2f4eebbca2e4f45741d719b652117c8acaeff6bff499e0c76c59420

Contents?: true

Size: 1.39 KB

Versions: 11

Compression:

Stored size: 1.39 KB

Contents

require "pact_broker/db/data_migrations/set_interactions_counts"

module PactBroker
  module DB
    module DataMigrations
      describe SetInteractionsCounts do
        describe ".call" do
          before do
            td.create_consumer("Foo")
              .create_provider("Bar")
              .create_consumer_version("1")
              .create_pact(json_content: { interactions: [1, 2] }.to_json )
              .create_consumer_version("2")
              .create_pact(json_content: { interactions: [1, 2, 3] }.to_json )
              .create_provider("Bop")
              .create_pact(json_content: { messages: [1] }.to_json )
            PactBroker::Pacts::PactVersion.dataset.update(interactions_count: nil, messages_count: nil)
          end

          subject { SetInteractionsCounts.call(PactBroker::Pacts::PactVersion.db) }

          it "sets the interactions and messages counts" do
            subject
            pact_versions = PactBroker::Pacts::PactVersion.order(:id).all
            expect(pact_versions[0].interactions_count).to eq nil
            expect(pact_versions[0].messages_count).to eq nil

            expect(pact_versions[1].interactions_count).to eq 3
            expect(pact_versions[1].messages_count).to eq 0

            expect(pact_versions[2].interactions_count).to eq 0
            expect(pact_versions[2].messages_count).to eq 1
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pact_broker-2.89.1 spec/lib/pact_broker/db/data_migrations/set_interactions_counts_spec.rb
pact_broker-2.89.0 spec/lib/pact_broker/db/data_migrations/set_interactions_counts_spec.rb
pact_broker-2.88.0 spec/lib/pact_broker/db/data_migrations/set_interactions_counts_spec.rb
pact_broker-2.87.0 spec/lib/pact_broker/db/data_migrations/set_interactions_counts_spec.rb
pact_broker-2.86.0 spec/lib/pact_broker/db/data_migrations/set_interactions_counts_spec.rb
pact_broker-2.85.1 spec/lib/pact_broker/db/data_migrations/set_interactions_counts_spec.rb
pact_broker-2.85.0 spec/lib/pact_broker/db/data_migrations/set_interactions_counts_spec.rb
pact_broker-2.84.0 spec/lib/pact_broker/db/data_migrations/set_interactions_counts_spec.rb
pact_broker-2.83.0 spec/lib/pact_broker/db/data_migrations/set_interactions_counts_spec.rb
pact_broker-2.82.0 spec/lib/pact_broker/db/data_migrations/set_interactions_counts_spec.rb
pact_broker-2.81.0 spec/lib/pact_broker/db/data_migrations/set_interactions_counts_spec.rb