-
-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add HAL documentation for the relations that were missing docum…
…entation Added tests to ensure that all new relations will be documented in the future. FIxes: #221
- Loading branch information
Showing
8 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
lib/pact_broker/doc/views/latest-provider-pacts-with-tag.markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Latest pacts by provider | ||
|
||
Allowed methods: `GET` | ||
|
||
Given a provider name, this resource returns the latest pact for each consumer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Provider pacts | ||
|
||
Allowed methods: `GET` | ||
|
||
Given a pacticipant name, this resource returns all the pact versions for all consumers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
require 'spec_helper' | ||
require 'pact_broker/doc/controllers/app' | ||
|
||
module PactBroker | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |