Sha256: 5bddcca834dd7f6d1c504926c44a69a3a5433e0e0a10f8847ce0d6bbb5ed806c

Contents?: true

Size: 1.82 KB

Versions: 6

Compression:

Stored size: 1.82 KB

Contents

require "pact_broker/matrix/parse_can_i_deploy_query"

module PactBroker
  module Matrix
    describe ParseCanIDeployQuery do
      describe ".call" do
        let(:params) do
          {
            pacticipant: "foo",
            version: "1",
            environment: "prod"
          }
        end

        subject(:result) { ParseCanIDeployQuery.call(params) }

        let(:parsed_selectors) { result.first }
        let(:parsed_options) { result.last }

        describe "parsed_options" do
          subject { parsed_options }

          its([:latestby]) { is_expected.to eq "cvp" }
          its([:latest]) { is_expected.to eq nil }
          its([:environment_name]) { is_expected.to eq "prod" }
          its([:ignore_selectors]) { is_expected.to eq [] }

          context "with pacticipants to ignore" do
            before do
              params[:ignore] = ["foo", "bar", {"a" => "b"}]
            end

            its([:ignore_selectors]) do
              is_expected.to eq [
                PactBroker::Matrix::UnresolvedSelector.new(pacticipant_name: "foo"),
                PactBroker::Matrix::UnresolvedSelector.new(pacticipant_name: "bar")
              ]
            end
          end

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

            its([:latestby]) { is_expected.to eq "cvp" }
            its([:latest]) { is_expected.to eq true }
            its([:tag]) { is_expected.to eq "prod" }
          end
        end

        describe "parsed_selectors" do
          subject { parsed_selectors }

          it { is_expected.to eq [PactBroker::Matrix::UnresolvedSelector.new(pacticipant_name: "foo", pacticipant_version_number: "1")] }
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pact_broker-2.86.0 spec/lib/pact_broker/matrix/parse_can_i_deploy_query_spec.rb
pact_broker-2.85.1 spec/lib/pact_broker/matrix/parse_can_i_deploy_query_spec.rb
pact_broker-2.85.0 spec/lib/pact_broker/matrix/parse_can_i_deploy_query_spec.rb
pact_broker-2.84.0 spec/lib/pact_broker/matrix/parse_can_i_deploy_query_spec.rb
pact_broker-2.83.0 spec/lib/pact_broker/matrix/parse_can_i_deploy_query_spec.rb
pact_broker-2.82.0 spec/lib/pact_broker/matrix/parse_can_i_deploy_query_spec.rb