Sha256: 240e015446f8000f9230f6377ad346561f4f1422225b8c50e934e78113363d90

Contents?: true

Size: 877 Bytes

Versions: 1

Compression:

Stored size: 877 Bytes

Contents

require 'pact_broker/webhooks/render'
require 'cgi'

module PactBroker
  module Webhooks
    describe Render do
      describe "#call" do
        before do
          allow(PactBroker::Api::PactBrokerUrls).to receive(:pact_url).and_return("http://foo")
        end

        let(:body) do
          "Foo ${pactbroker.pactUrl} ${pactbroker.consumerVersionNumber}"
        end

        let(:pact) do
          instance_double("pact", consumer_version_number: "1.2.3+foo")
        end

        subject { Render.call(body, pact, nil) }

        it { is_expected.to eq "Foo http://foo 1.2.3+foo" }

        context "with an escaper" do
          subject do
            Render.call(body, pact, nil) do | value |
              CGI.escape(value)
            end
          end

          it { is_expected.to eq "Foo http%3A%2F%2Ffoo 1.2.3%2Bfoo" }
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pact_broker-2.20.0 spec/lib/pact_broker/webhooks/render_spec.rb