-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
83 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'json' | ||
|
||
describe "pact-provider-verifier with a provider state injected to a pact file" do | ||
before(:all) do | ||
@pipe = IO.popen("bundle exec rackup -p 5837 spec/support/provider_with_state_generator.rb") | ||
sleep 2 | ||
end | ||
|
||
subject { `bundle exec bin/pact-provider-verifier spec/support/pacts/pact-with-provider-state-in-headers.json -a 1 --provider-base-url http://localhost:5837/ --provider-states-setup-url http://localhost:5837/provider_state -v` } | ||
|
||
it "exits with a 0 exit code" do | ||
subject | ||
expect($?).to eq 0 | ||
end | ||
|
||
it "the output contains a success message" do | ||
expect(subject).to include "1 interaction, 0 failures" | ||
end | ||
|
||
after(:all) do | ||
Process.kill 'KILL', @pipe.pid | ||
end | ||
end |
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
67 changes: 0 additions & 67 deletions
67
spec/lib/pact/provider_verifier/set_up_provider_state_inject_parameters_spec.rb
This file was deleted.
Oops, something went wrong.
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
44 changes: 44 additions & 0 deletions
44
spec/support/pacts/pact-with-provider-state-in-headers.json
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,44 @@ | ||
{ | ||
"provider": { | ||
"name": "Foo" | ||
}, | ||
"consumer": { | ||
"name": "Bar" | ||
}, | ||
"interactions": [ | ||
{ | ||
"description": "requires access token", | ||
"request": { | ||
"method": "GET", | ||
"path": "/requires_auth", | ||
"headers": { | ||
"Authorization": "Bearer EXAMPLE_TOKEN" | ||
}, | ||
"generators": { | ||
"header": { | ||
"$.Authorization": { | ||
"expression": "Bearer ${accessToken}", | ||
"type": "ProviderState" | ||
} | ||
} | ||
} | ||
}, | ||
"response": { | ||
"status": 200 | ||
}, | ||
"providerStates": [ | ||
{ | ||
"name": "returns access token" | ||
} | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"pactSpecification": { | ||
"version": "3.0.0" | ||
}, | ||
"pact-jvm": { | ||
"version": "4.0.5" | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -39,4 +39,4 @@ | |
"version": "4.0.5" | ||
} | ||
} | ||
} | ||
} |
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