Sha256: 28c451060d35b9fb72eba794779d947389898f065e78180948731b52dd0ff6c6

Contents?: true

Size: 930 Bytes

Versions: 22

Compression:

Stored size: 930 Bytes

Contents

require 'pact_broker/doc/controllers/app'

RSpec.describe "the HAL docs for the index" do

  let(:app) do
    Rack::Builder.new do
      map "/docs" do
        run PactBroker::Doc::Controllers::App
      end
      map "/" do
        run PactBroker::API
      end
    end
  end

  let(:index_response) { get "/", {}, { 'HTTP_ACCEPT' => 'application/hal+json' } }
  let(:index_body) { JSON.parse(index_response.body) }

  it "has a document for each relation" do
    relations_that_should_have_docs = index_body['_links'].keys - ['self', 'curies']
    relations_without_docs = {}

    relations_that_should_have_docs.each do | relation |
      path = "/docs/#{relation.split(":", 2).last}?context=index"
      get path, {}, { 'HTTP_ACCEPT' => 'text/html' }
      if last_response.status != 200
        relations_without_docs[relation] = last_response.status
      end
    end

    expect(relations_without_docs).to eq({})
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
pact_broker-2.38.1 spec/lib/pact_broker/doc/coverage_spec.rb
pact_broker-2.38.0 spec/lib/pact_broker/doc/coverage_spec.rb
pact_broker-2.37.0 spec/lib/pact_broker/doc/coverage_spec.rb
pact_broker-2.36.1 spec/lib/pact_broker/doc/coverage_spec.rb
pact_broker-2.36.0 spec/lib/pact_broker/doc/coverage_spec.rb
pact_broker-2.35.0 spec/lib/pact_broker/doc/coverage_spec.rb
pact_broker-2.34.0 spec/lib/pact_broker/doc/coverage_spec.rb
pact_broker-2.33.0 spec/lib/pact_broker/doc/coverage_spec.rb
pact_broker-2.32.0 spec/lib/pact_broker/doc/coverage_spec.rb
pact_broker-2.31.0 spec/lib/pact_broker/doc/coverage_spec.rb
pact_broker-2.30.0 spec/lib/pact_broker/doc/coverage_spec.rb
pact_broker-2.29.0 spec/lib/pact_broker/doc/coverage_spec.rb
pact_broker-2.27.6 spec/lib/pact_broker/doc/coverage_spec.rb
pact_broker-2.27.5 spec/lib/pact_broker/doc/coverage_spec.rb
pact_broker-2.27.4 spec/lib/pact_broker/doc/coverage_spec.rb
pact_broker-2.27.3 spec/lib/pact_broker/doc/coverage_spec.rb
pact_broker-2.27.2 spec/lib/pact_broker/doc/coverage_spec.rb
pact_broker-2.27.0 spec/lib/pact_broker/doc/coverage_spec.rb
pact_broker-2.26.1 spec/lib/pact_broker/doc/coverage_spec.rb
pact_broker-2.26.0 spec/lib/pact_broker/doc/coverage_spec.rb