Sha256: bc40dc6b6cdfc11767f7f4980a4d75c09fc6d220c25e424450d32e1ea666b320

Contents?: true

Size: 1.65 KB

Versions: 31

Compression:

Stored size: 1.65 KB

Contents

require 'spec_helper'
require 'pact/doc/markdown/consumer_contract_renderer'
require 'pact/support'

module Pact
  module Doc
    module Markdown
      describe ConsumerContractRenderer do

        subject { ConsumerContractRenderer.new(consumer_contract) }
        let(:consumer_contract) { Pact::ConsumerContract.from_uri './spec/support/markdown_pact.json' }

        let(:expected_output) { File.read("./spec/support/generated_markdown.md", external_encoding: Encoding::UTF_8) }

        describe "#call" do

          context "with markdown characters in the pacticipant names" do
            let(:consumer_contract) { Pact::ConsumerContract.from_uri './spec/support/markdown_pact_with_markdown_chars_in_names.json' }

            it "escapes the markdown characters" do
              expect(subject.call).to include '### A pact between Some\*Consumer\*App and Some\_Provider\_App'
              expect(subject.call).to include '#### Requests from Some\*Consumer\*App to Some\_Provider\_App'
            end
          end

          context "with ruby's default external encoding is not UTF-8" do
            around do |example|
              back = nil
              WarningSilencer.enable { back, Encoding.default_external = Encoding.default_external, Encoding::ASCII_8BIT }
              example.run
              WarningSilencer.enable { Encoding.default_external = back }
            end

            it "renders the interactions" do
              expect(subject.call).to eq(expected_output)
            end
          end

          it "renders the interactions" do
            expect(subject.call).to eq(expected_output)
          end
        end

      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
pact_broker-2.30.0 spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb
pact_broker-2.29.0 spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb
pact_broker-2.27.6 spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb
pact_broker-2.27.5 spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb
pact_broker-2.27.4 spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb
pact_broker-2.27.3 spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb
pact_broker-2.27.2 spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb
pact_broker-2.27.0 spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb
pact_broker-2.26.1 spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb
pact_broker-2.26.0 spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb
pact_broker-2.25.0 spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb
pact_broker-2.24.0 spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb
pact_broker-2.23.4 spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb
pact_broker-2.23.3 spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb
pact_broker-2.23.2 spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb
pact_broker-2.23.1 spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb
pact_broker-2.23.0 spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb
pact_broker-2.22.0 spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb
pact_broker-2.21.0 spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb
pact_broker-2.20.0 spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb