Sha256: 8930f887531307e9806a1e68e2bc2bbf1e74c11895904f06328ad8c7d013fa79

Contents?: true

Size: 1.81 KB

Versions: 12

Compression:

Stored size: 1.81 KB

Contents

require "pact_broker/matrix/can_i_deploy_query_schema"

module PactBroker
  module Api
    module Contracts
      describe CanIDeployQuerySchema do
        subject { CanIDeployQuerySchema.call(params) }

        context "with valid params" do
          let(:params) do
            {
              pacticipant: "foo",
              version: "1",
              to: "prod"
            }
          end

          it { is_expected.to be_empty }
        end

        context "with a to tag and an environment specified" do
          before do
            allow(PactBroker::Deployments::EnvironmentService).to receive(:find_by_name).and_return(double("environment"))
          end

          let(:params) do
            {
              pacticipant: "foo",
              version: "1",
              environment: "prod",
              to: "prod"
            }
          end

          it { is_expected.to_not be_empty }
        end

        context "when the environment does exist" do
          before do
            allow(PactBroker::Deployments::EnvironmentService).to receive(:find_by_name).and_return(double("environment"))
          end

          let(:params) do
            {
              pacticipant: "foo",
              version: "1",
              environment: "prod"
            }
          end

          it { is_expected.to be_empty }
        end

        context "when the environment does not exist" do
          before do
            allow(PactBroker::Deployments::EnvironmentService).to receive(:find_by_name).and_return(nil)
          end

          let(:params) do
            {
              pacticipant: "foo",
              version: "1",
              environment: "prod"
            }
          end

          its([:environment, 0]) { is_expected.to eq "environment with name 'prod' does not exist" }
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pact_broker-2.89.1 spec/lib/pact_broker/matrix/can_i_deploy_query_schema_spec.rb
pact_broker-2.89.0 spec/lib/pact_broker/matrix/can_i_deploy_query_schema_spec.rb
pact_broker-2.88.0 spec/lib/pact_broker/matrix/can_i_deploy_query_schema_spec.rb
pact_broker-2.87.0 spec/lib/pact_broker/matrix/can_i_deploy_query_schema_spec.rb
pact_broker-2.86.0 spec/lib/pact_broker/matrix/can_i_deploy_query_schema_spec.rb
pact_broker-2.85.1 spec/lib/pact_broker/matrix/can_i_deploy_query_schema_spec.rb
pact_broker-2.85.0 spec/lib/pact_broker/matrix/can_i_deploy_query_schema_spec.rb
pact_broker-2.84.0 spec/lib/pact_broker/matrix/can_i_deploy_query_schema_spec.rb
pact_broker-2.83.0 spec/lib/pact_broker/matrix/can_i_deploy_query_schema_spec.rb
pact_broker-2.82.0 spec/lib/pact_broker/matrix/can_i_deploy_query_schema_spec.rb
pact_broker-2.81.0 spec/lib/pact_broker/matrix/can_i_deploy_query_schema_spec.rb
pact_broker-2.80.0 spec/lib/pact_broker/matrix/can_i_deploy_query_schema_spec.rb