Sha256: 097a48b186406097734496349c2b0e9624700f88a40178083b1f89e091d9808b

Contents?: true

Size: 1.47 KB

Versions: 12

Compression:

Stored size: 1.47 KB

Contents

require "pact_broker/domain"
PACTICIPANT_LIMIT = 10
VERSION_LIMIT = 10

PACTICIPANTS = PactBroker::Domain::Pacticipant.order(Sequel.desc(:id)).limit(PACTICIPANT_LIMIT).all

RSpec.describe "regression tests" do

  def can_i_deploy(pacticipant_name, version_number, to_tag)
    get("/can-i-deploy", { pacticipant: pacticipant_name, version: version_number, to: to_tag }, { "HTTP_ACCEPT" => "application/hal+json" })
  end

  PACTICIPANTS.each do | pacticipant |
    describe pacticipant.name do

      versions = PactBroker::Domain::Version.where(pacticipant_id: pacticipant.id).order(Sequel.desc(:order)).limit(VERSION_LIMIT)
      versions.each do | version |
        describe "version #{version.number}" do
          it "has the same results for can-i-deploy" do

            can_i_deploy_response = can_i_deploy(pacticipant.name, version.number, "prod")
            results = {
              request: {
                name: "can-i-deploy",
                params: {
                  pacticipant_name: pacticipant.name,
                  version_number: version.number,
                  to_tag: "prod"
                }
              },
              response: {
                status: can_i_deploy_response.status,
                body: JSON.parse(can_i_deploy_response.body)
              }
            }

            Approvals.verify(results, :name => "regression_can_i_deploy_#{pacticipant.name}_version_#{version.number}", format: :json)
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pact_broker-2.89.1 regression/can_i_deploy_spec.rb
pact_broker-2.89.0 regression/can_i_deploy_spec.rb
pact_broker-2.88.0 regression/can_i_deploy_spec.rb
pact_broker-2.87.0 regression/can_i_deploy_spec.rb
pact_broker-2.86.0 regression/can_i_deploy_spec.rb
pact_broker-2.85.1 regression/can_i_deploy_spec.rb
pact_broker-2.85.0 regression/can_i_deploy_spec.rb
pact_broker-2.84.0 regression/can_i_deploy_spec.rb
pact_broker-2.83.0 regression/can_i_deploy_spec.rb
pact_broker-2.82.0 regression/can_i_deploy_spec.rb
pact_broker-2.81.0 regression/can_i_deploy_spec.rb
pact_broker-2.80.0 regression/can_i_deploy_spec.rb