pact-provider-proxy 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +3 -0
- data/CHANGELOG.md +8 -4
- data/README.md +2 -2
- data/lib/pact/provider/proxy/task_helper.rb +3 -0
- data/lib/pact/provider/proxy/version.rb +1 -1
- data/spec/lib/pact/provider/proxy/task_helper_spec.rb +42 -0
- data/spec/tasks.rake +14 -5
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b73783cf0db620e4c71da1a8988c01f75a210c36
|
4
|
+
data.tar.gz: 969d8e18def3a40f24fe172326142ac5c1dc26ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de4baaca1aba26841d77c0d1b13ecc1318f2d44aebf874cb6dd036e22b0e814666be1e2deacc8b1231587de05eae991f9d563b7a60fccb588a4139eaa3faa9c7
|
7
|
+
data.tar.gz: 321e95b935ce5aece188971496d66fa9e95289f275c3d193acb60d2b0b450a71a7886bc18b3fe7bceec62cab610806c7527efab12677e85ec1409cf533f314f9
|
data/.rspec
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,17 +1,21 @@
|
|
1
1
|
git log --pretty=format:' * %h - %s (%an, %ad)'
|
2
2
|
|
3
|
+
### 2.1.0 (21 April 2015)
|
4
|
+
|
5
|
+
* c94657c - Pass through PACT_DESCRIPTION, PACT_PROVIDER_STATE and BACKTRACE env vars to pact verify command (Beth Skurrie, Tue Apr 21 14:31:47 2015 +1000)
|
6
|
+
|
3
7
|
### 2.0.0 (14 November 2014)
|
4
8
|
|
5
|
-
* 4a95e2b - Removed automatic loading of pact_helper.rb. It was creating unexpected behaviour. (Beth, Fri Nov 14 16:19:20 2014 +1100)
|
9
|
+
* 4a95e2b - Removed automatic loading of pact_helper.rb. It was creating unexpected behaviour. (Beth Skurrie, Fri Nov 14 16:19:20 2014 +1100)
|
6
10
|
|
7
11
|
### 1.2.0 (14 October 2014)
|
8
12
|
|
9
|
-
* 6a6695c - Forked and vendored rack-reverse-proxy because no one is maintaining or releasing the gem (
|
13
|
+
* 6a6695c - Forked and vendored rack-reverse-proxy because no one is maintaining or releasing the gem (Beth Skurrie, Tue Oct 14 11:41:37 2014 +1100)
|
10
14
|
|
11
15
|
### 1.1.0 (18 September 2014)
|
12
16
|
|
13
|
-
* dd1117e - Updated pact version (
|
17
|
+
* dd1117e - Updated pact version (Beth Skurrie, Thu Sep 18 16:16:12 2014 +1000)
|
14
18
|
|
15
19
|
### 1.0.0 (5 June 2014)
|
16
20
|
|
17
|
-
* b697616 - Updated pact-provider-proxy to work with pact 1.1.1 (
|
21
|
+
* b697616 - Updated pact-provider-proxy to work with pact 1.1.1 (Beth Skurrie, Thu Jun 5 18:38:10 2014 +1000)
|
data/README.md
CHANGED
@@ -23,14 +23,14 @@ Or install it yourself as:
|
|
23
23
|
Usually, you would configure and run pact:verify in the provider code base.
|
24
24
|
If you are using pact-provider-proxy to run your pact verify task, it is probably because you don't have access to the code base of the provider project, or it is not a ruby project, so it may make sense to include this task in your consumer project.
|
25
25
|
|
26
|
-
Specifying a pact_helper is optional, and is only required if you are using provider states.
|
26
|
+
Specifying a pact_helper is optional, and is only required if you are using provider states or you need to configure Pact. Note that the pact_helper for the `ProxyVerificationTask` will not be automatically loaded like it is for the regular `pact:verify` - you must specify the path yourself if you need one (see the example below). The configuration options for the provider code will be different from the consumer code, so you cannot reuse the pact_helper from your consumer tests.
|
27
27
|
|
28
28
|
```ruby
|
29
29
|
require 'pact/provider/proxy/tasks'
|
30
30
|
|
31
31
|
Pact::ProxyVerificationTask.new :monolith do | task |
|
32
32
|
task.pact_url './spec/pacts/my-consumer_my-monolith.json', :pact_helper => './spec/support/monolith_pact_helper'
|
33
|
-
task.provider_base_url 'http://my-monolith'
|
33
|
+
task.provider_base_url 'http://my-monolith:8080' #scheme, host and optional port
|
34
34
|
end
|
35
35
|
```
|
36
36
|
|
@@ -23,6 +23,9 @@ module Pact
|
|
23
23
|
command_parts << "-S pact verify"
|
24
24
|
command_parts << "-h" << (pact_helper.end_with?(".rb") ? pact_helper : pact_helper + ".rb")
|
25
25
|
(command_parts << "-p" << pact_uri) if pact_uri
|
26
|
+
command_parts << "--description #{Shellwords.escape(ENV['PACT_DESCRIPTION'])}" if ENV['PACT_DESCRIPTION']
|
27
|
+
command_parts << "--provider-state #{Shellwords.escape(ENV['PACT_PROVIDER_STATE'])}" if ENV['PACT_PROVIDER_STATE']
|
28
|
+
command_parts << "--backtrace" if ENV['BACKTRACE'] == 'true'
|
26
29
|
command_parts.flatten.join(" ")
|
27
30
|
end
|
28
31
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'pact/provider/proxy/task_helper'
|
2
|
+
|
3
|
+
module Pact
|
4
|
+
module Provider
|
5
|
+
module Proxy
|
6
|
+
describe TaskHelper do
|
7
|
+
|
8
|
+
include TaskHelper
|
9
|
+
|
10
|
+
let(:pact_helper) { './pact_helper.rb' }
|
11
|
+
let(:pact_uri) { 'http://pact.com/pact.json' }
|
12
|
+
let(:command) { verify_command pact_helper, pact_uri }
|
13
|
+
|
14
|
+
before do
|
15
|
+
allow(ENV).to receive(:[]).with('PACT_DESCRIPTION').and_return('desc ription')
|
16
|
+
allow(ENV).to receive(:[]).with('PACT_PROVIDER_STATE').and_return('state')
|
17
|
+
allow(ENV).to receive(:[]).with('BACKTRACE').and_return('true')
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "#verify_command" do
|
21
|
+
context "when the PACT_DESCRIPTION is set" do
|
22
|
+
it "includes the --description option" do
|
23
|
+
expect(command).to include " --description desc\\ ription "
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context "when the PACT_PROVIDER_STATE is set" do
|
28
|
+
it "includes the --provider-state option" do
|
29
|
+
expect(command).to include " --provider-state state "
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context "when the BACKTRACE is set" do
|
34
|
+
it "includes the --backtrace option" do
|
35
|
+
expect(command).to include " --backtrace"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/spec/tasks.rake
CHANGED
@@ -13,9 +13,16 @@ end
|
|
13
13
|
namespace :pact do
|
14
14
|
namespace :test do
|
15
15
|
task :spawn_test_monolith do
|
16
|
-
require 'pact/
|
17
|
-
|
18
|
-
|
16
|
+
require 'pact/mock_service/app_manager'
|
17
|
+
app = lambda { | env |
|
18
|
+
if env['PATH_INFO'] == '/some-path' && env['QUERY_STRING'] == 'foo=bar'
|
19
|
+
[200, {}, ["Monolith!"]]
|
20
|
+
else
|
21
|
+
[500, {}, []]
|
22
|
+
end
|
23
|
+
}
|
24
|
+
Pact::MockService::AppManager.instance.register app, 9292
|
25
|
+
Pact::MockService::AppManager.instance.spawn_all
|
19
26
|
end
|
20
27
|
end
|
21
28
|
end
|
@@ -39,8 +46,10 @@ end
|
|
39
46
|
task 'pact:verify:monolith' => ['pact:test:spawn_test_monolith', 'delete_pact_helper', 'create_custom_pact_helper']
|
40
47
|
task 'pact:verify:monolith_no_pact_helper' => ['pact:test:spawn_test_monolith', 'delete_pact_helper', 'create_pact_helper_that_should_not_be_loaded']
|
41
48
|
|
49
|
+
require 'rspec/core/rake_task'
|
42
50
|
|
43
|
-
|
44
|
-
|
51
|
+
RSpec::Core::RakeTask.new(:spec)
|
52
|
+
|
53
|
+
task :default => [:spec, 'pact:verify:monolith_no_pact_helper','pact:verify:monolith']
|
45
54
|
|
46
55
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pact-provider-proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Beth
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pact
|
@@ -108,6 +108,7 @@ extensions: []
|
|
108
108
|
extra_rdoc_files: []
|
109
109
|
files:
|
110
110
|
- ".gitignore"
|
111
|
+
- ".rspec"
|
111
112
|
- CHANGELOG.md
|
112
113
|
- Gemfile
|
113
114
|
- LICENSE.txt
|
@@ -123,6 +124,7 @@ files:
|
|
123
124
|
- script/update-rack-reverse-proxy.sh
|
124
125
|
- spec/fixtures/do_not_load_pact_helper.rb
|
125
126
|
- spec/fixtures/template_pact_helper.rb
|
127
|
+
- spec/lib/pact/provider/proxy/task_helper_spec.rb
|
126
128
|
- spec/support/custom_pact_helper.rb
|
127
129
|
- spec/support/pact-with-no-provider-states.json
|
128
130
|
- spec/support/pact.json
|
@@ -172,6 +174,7 @@ summary: Allows verification of a pact against a running provider
|
|
172
174
|
test_files:
|
173
175
|
- spec/fixtures/do_not_load_pact_helper.rb
|
174
176
|
- spec/fixtures/template_pact_helper.rb
|
177
|
+
- spec/lib/pact/provider/proxy/task_helper_spec.rb
|
175
178
|
- spec/support/custom_pact_helper.rb
|
176
179
|
- spec/support/pact-with-no-provider-states.json
|
177
180
|
- spec/support/pact.json
|