diff --git a/lib/pact_broker/doc/views/latest-provider-pacts-with-tag.markdown b/lib/pact_broker/doc/views/latest-provider-pacts-with-tag.markdown new file mode 100644 index 000000000..d31cfa756 --- /dev/null +++ b/lib/pact_broker/doc/views/latest-provider-pacts-with-tag.markdown @@ -0,0 +1,5 @@ +# Latest pacts for provider with the specified tag + +Allowed methods: `GET` + +Given a provider name and a consumer version tag name, this resource returns the latest pact for each consumer that has the specified tag. diff --git a/lib/pact_broker/doc/views/latest-provider-pacts.markdown b/lib/pact_broker/doc/views/latest-provider-pacts.markdown new file mode 100644 index 000000000..bbce0cd85 --- /dev/null +++ b/lib/pact_broker/doc/views/latest-provider-pacts.markdown @@ -0,0 +1,5 @@ +# Latest pacts by provider + +Allowed methods: `GET` + +Given a provider name, this resource returns the latest pact for each consumer. diff --git a/lib/pact_broker/doc/views/latest-tagged-version.markdown b/lib/pact_broker/doc/views/latest-tagged-version.markdown new file mode 100644 index 000000000..893f312a9 --- /dev/null +++ b/lib/pact_broker/doc/views/latest-tagged-version.markdown @@ -0,0 +1,5 @@ +# Latest pacticipant version with the specified tag + +Allowed methods: `GET` + +Given a pacticipant name and a pacticipant version tag name, this resource returns the latest pacticipant version with the specified tag. Note that the "latest" is determined by the creation date of the pacticipant version resource (or the semantic order if `order_versions_by_date` is false), not by the creation date of the tag. diff --git a/lib/pact_broker/doc/views/latest-version.markdown b/lib/pact_broker/doc/views/latest-version.markdown new file mode 100644 index 000000000..c824d9323 --- /dev/null +++ b/lib/pact_broker/doc/views/latest-version.markdown @@ -0,0 +1,7 @@ +# Latest pacticipant version + +Allowed methods: `GET` + +Given a pacticipant name, this resource returns the latest pacticipant version according to the configured ordering scheme. Ordering will be by creation date of the version resource if `order_versions_by_date` is true, and will be by semantic order if `order_versions_by_date` is false. + +Note that this resource represents a pacticipant (application) version, not a pact version. diff --git a/lib/pact_broker/doc/views/provider-pacts-with-tag.markdown b/lib/pact_broker/doc/views/provider-pacts-with-tag.markdown new file mode 100644 index 000000000..77262ec32 --- /dev/null +++ b/lib/pact_broker/doc/views/provider-pacts-with-tag.markdown @@ -0,0 +1,5 @@ +# Provider pacts + +Allowed methods: `GET` + +Given a pacticipant name and a consumer version tag, this resource returns all the pact versions for all consumers of this provider with the specified tag. The most common use of this resource is to find all the `production` pact versions for the mobile consumers of an API, so that backwards compatibility can be maintained. diff --git a/lib/pact_broker/doc/views/provider-pacts.markdown b/lib/pact_broker/doc/views/provider-pacts.markdown new file mode 100644 index 000000000..7ed4dda4b --- /dev/null +++ b/lib/pact_broker/doc/views/provider-pacts.markdown @@ -0,0 +1,5 @@ +# Provider pacts + +Allowed methods: `GET` + +Given a pacticipant name, this resource returns all the pact versions for all consumers. diff --git a/spec/lib/pact_broker/doc/controllers/app_spec.rb b/spec/lib/pact_broker/doc/controllers/app_spec.rb index 00a704bcc..dbfd8b50a 100644 --- a/spec/lib/pact_broker/doc/controllers/app_spec.rb +++ b/spec/lib/pact_broker/doc/controllers/app_spec.rb @@ -1,4 +1,3 @@ -require 'spec_helper' require 'pact_broker/doc/controllers/app' module PactBroker diff --git a/spec/lib/pact_broker/doc/coverage_spec.rb b/spec/lib/pact_broker/doc/coverage_spec.rb new file mode 100644 index 000000000..c34ac2303 --- /dev/null +++ b/spec/lib/pact_broker/doc/coverage_spec.rb @@ -0,0 +1,33 @@ +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}" + 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