Sha256: 1e6a8e08d2bf982c352f8f4a2833125a1c4c3e2165fca5058c42bd1161e81761

Contents?: true

Size: 1.46 KB

Versions: 4

Compression:

Stored size: 1.46 KB

Contents

PACTICIPANT_LIMIT = 2
VERSION_LIMIT = 1

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

RSpec.describe "regression tests", no_db_clean: true, regression: true 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

4 entries across 4 versions & 1 rubygems

Version Path
pact_broker-2.76.2 regression/can_i_deploy_spec.rb
pact_broker-2.76.1 regression/can_i_deploy_spec.rb
pact_broker-2.76.0 regression/can_i_deploy_spec.rb
pact_broker-2.75.0 regression/can_i_deploy_spec.rb