Skip to content

Commit

Permalink
Add stub_any_publishing_api_unreserve_path test helper
Browse files Browse the repository at this point in the history
This is one of the few stubbed methods that didn't have an any
equivalent and thus was a source of surprise.
  • Loading branch information
kevindew committed Feb 10, 2020
1 parent c7418aa commit 895b65a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1,5 +1,6 @@
# Unreleased

* Add `stub_any_publishing_api_unreserve_path` test helper.
* Fix Publishing API `stub_any_publishing_api_call` methods only operating on
the V2 endpoint.

Expand Down
4 changes: 4 additions & 0 deletions lib/gds_api/test_helpers/publishing_api.rb
Expand Up @@ -640,6 +640,10 @@ def stub_publishing_api_unreserve_path_invalid(base_path, publishing_app = /.*/)
stub_publishing_api_unreserve_path_with_code(base_path, publishing_app, 422)
end

def stub_any_publishing_api_unreserve_path
stub_request(:delete, %r{\A#{PUBLISHING_API_ENDPOINT}/paths/})
end

# Stub a PUT /publish-intent/:base_path request with the given base_path
# and request body.
#
Expand Down
9 changes: 9 additions & 0 deletions test/test_helpers/publishing_api_test.rb
Expand Up @@ -427,6 +427,15 @@
end
end

describe "#stub_any_publishing_api_unreserve_path" do
it "stubs a request to unreserve a path" do
stub_any_publishing_api_unreserve_path

api_response = publishing_api.unreserve_path("/foo", "myapp")
assert_equal(api_response.code, 200)
end
end

describe "#stub_any_publishing_api_path_reservation" do
it "stubs a request to reserve a path" do
stub_any_publishing_api_path_reservation
Expand Down

0 comments on commit 895b65a

Please sign in to comment.