Sha256: 2a67bf65a811a39bf5060702298649f7cc81b9ccfb0b59e1b1aad4bb7bf6cd05

Contents?: true

Size: 1.59 KB

Versions: 3

Compression:

Stored size: 1.59 KB

Contents

require 'spec_helper'
require 'pact_broker/api/renderers/html_pact_renderer'

module PactBroker
  module Api
    module Renderers
      describe HtmlPactRenderer do

        before do
          ENV['BACKUP_TZ'] = ENV['TZ']
          ENV['TZ'] = "Australia/Melbourne"
        end

        after do
          ENV['TZ'] = ENV['BACKUP_TZ']
        end

        let(:consumer) { double('consumer', name: 'Consumer')}
        let(:created_at) { DateTime.new(2014, 02, 27) }
        let(:json_content) { load_fixture('renderer_pact.json') }
        let(:pact) { double('pact', json_content: json_content, updated_at: created_at, consumer_version_number: '1.2.3', consumer: consumer)}
        let(:pact_url) { '/pact/url' }

        before do
          allow(PactBroker::Api::PactBrokerUrls).to receive(:pact_url).with('', pact).and_return(pact_url)
        end

        subject { HtmlPactRenderer.call pact }

        describe ".call" do
          it "renders the pact as HTML" do
            expect(subject).to include("<html>")
            expect(subject).to include("</html>")
            expect(subject).to include("<link rel='stylesheet'")
            expect(subject).to include("href='/stylesheets/github.css'")
            expect(subject).to include('<pre><code')
            expect(subject).to include('&quot;method&quot;:')
            expect(subject).to match /<h\d>.*Some Consumer/
            expect(subject).to match /<h\d>.*Some Provider/
            expect(subject).to include("Date published:")
            expect(subject).to include("Thu 27 Feb 2014, 11:00am +11:00")
          end
        end

      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pact_broker-1.5.0 spec/lib/pact_broker/api/renderers/html_pact_renderer_spec.rb
pact_broker-1.4.0 spec/lib/pact_broker/api/renderers/html_pact_renderer_spec.rb
pact_broker-1.3.2.rc1 spec/lib/pact_broker/api/renderers/html_pact_renderer_spec.rb