-
-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(verification results): redirect requests for verification result…
…s to the HAL browser if requested in a web browser
- Loading branch information
Showing
3 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
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
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
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,27 @@ | ||
require 'rack/pact_broker/hal_browser_redirect' | ||
|
||
module Rack | ||
module PactBroker | ||
describe HalBrowserRedirect do | ||
let(:target_app) { ->(env){ [200, {}, []] } } | ||
let(:app) { HalBrowserRedirect.new(target_app) } | ||
let(:rack_env) do | ||
{ | ||
"pactbroker.base_url" => "http://base/foo", | ||
"HTTP_ACCEPT" => "text/html" | ||
} | ||
end | ||
|
||
subject { get(path, nil, rack_env) } | ||
|
||
context "when requesting verification results" do | ||
let(:path) { "/pacts/provider/Bar/consumer/Foo/pact-version/a2456ade40d0e148e23fb3310ec56831fef6ce8e/verification-results/106" } | ||
|
||
it "redirects to the HAL browser" do | ||
expect(subject.status).to eq 303 | ||
expect(subject.headers["Location"]).to eq "http://base/foo/hal-browser/browser.html#http://base/foo/pacts/provider/Bar/consumer/Foo/pact-version/a2456ade40d0e148e23fb3310ec56831fef6ce8e/verification-results/106" | ||
end | ||
end | ||
end | ||
end | ||
end |