pact 1.34.0 → 1.36.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/lib/pact/provider/rspec.rb +2 -2
- data/lib/pact/provider/state/provider_state.rb +6 -7
- data/lib/pact/provider/state/provider_state_manager.rb +10 -10
- data/lib/pact/provider/state/set_up.rb +1 -1
- data/lib/pact/provider/state/tear_down.rb +1 -1
- data/lib/pact/provider/test_methods.rb +8 -4
- data/lib/pact/version.rb +1 -1
- data/pact.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b30477b50a98ca1563f8d3dea130b68cd7cbf88c
|
4
|
+
data.tar.gz: 43212f356f6580287d135da4b85b6e23ad039d0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f68cc2abcf6ad6bd93f6804c1509dc15c6f23a9f697bf988186d9b630cd846323c56082a59bf978dc5e729519cfc2f51d6a54634f083948f18a66cd599591645
|
7
|
+
data.tar.gz: 8495fc3f5bdf6bef3d859bcf3f4c58d2666e6423b615b79fb2542460cf0ce9947e226da184de301831f15a90a227e9ae9532d775021d481b69a3c9159f3a8437
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
<a name="v1.36.0"></a>
|
2
|
+
### v1.36.0 (2018-10-04)
|
3
|
+
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* **v3**
|
8
|
+
* make provider state params available to set up and tear down blocks ([9593730](/../../commit/9593730))
|
9
|
+
* support set up and tear down of multiple provider states ([cbad0be](/../../commit/cbad0be))
|
10
|
+
|
11
|
+
|
1
12
|
<a name="v1.34.0"></a>
|
2
13
|
### v1.34.0 (2018-09-06)
|
3
14
|
|
data/lib/pact/provider/rspec.rb
CHANGED
@@ -84,7 +84,7 @@ module Pact
|
|
84
84
|
before do | example |
|
85
85
|
interaction_context.run_once :before do
|
86
86
|
Pact.configuration.logger.info "Running example '#{Pact::RSpec.full_description(example)}'"
|
87
|
-
|
87
|
+
set_up_provider_states interaction.provider_states, options[:consumer]
|
88
88
|
replay_interaction interaction, options[:request_customizer]
|
89
89
|
interaction_context.last_response = last_response
|
90
90
|
end
|
@@ -92,7 +92,7 @@ module Pact
|
|
92
92
|
|
93
93
|
after do
|
94
94
|
interaction_context.run_once :after do
|
95
|
-
|
95
|
+
tear_down_provider_states interaction.provider_states, options[:consumer]
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
@@ -116,17 +116,17 @@ module Pact
|
|
116
116
|
@no_op_defined = true
|
117
117
|
end
|
118
118
|
|
119
|
-
def set_up
|
119
|
+
def set_up params = {}
|
120
120
|
if @set_up_block
|
121
121
|
include_provider_state_configured_modules
|
122
|
-
|
122
|
+
instance_exec params, &@set_up_block
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
126
|
-
def tear_down
|
126
|
+
def tear_down params = {}
|
127
127
|
if @tear_down_block
|
128
128
|
include_provider_state_configured_modules
|
129
|
-
|
129
|
+
instance_exec params, &@tear_down_block
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
@@ -168,14 +168,13 @@ module Pact
|
|
168
168
|
|
169
169
|
class NoOpProviderState
|
170
170
|
|
171
|
-
def self.set_up
|
171
|
+
def self.set_up params = {}
|
172
172
|
|
173
173
|
end
|
174
174
|
|
175
|
-
def self.tear_down
|
175
|
+
def self.tear_down params = {}
|
176
176
|
|
177
177
|
end
|
178
|
-
|
179
178
|
end
|
180
179
|
end
|
181
180
|
end
|
@@ -2,27 +2,28 @@ module Pact
|
|
2
2
|
module Provider::State
|
3
3
|
class ProviderStateManager
|
4
4
|
|
5
|
-
attr_reader :provider_state_name, :consumer
|
5
|
+
attr_reader :provider_state_name, :params, :consumer
|
6
6
|
|
7
|
-
def initialize provider_state_name, consumer
|
7
|
+
def initialize provider_state_name, params, consumer
|
8
8
|
@provider_state_name = provider_state_name
|
9
|
+
@params = params
|
9
10
|
@consumer = consumer
|
10
11
|
end
|
11
12
|
|
12
13
|
def set_up_provider_state
|
13
|
-
get_global_base_provider_state.set_up
|
14
|
-
get_consumer_base_provider_state.set_up
|
14
|
+
get_global_base_provider_state.set_up(params)
|
15
|
+
get_consumer_base_provider_state.set_up(params)
|
15
16
|
if provider_state_name
|
16
|
-
get_provider_state.set_up
|
17
|
+
get_provider_state.set_up(params)
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
20
21
|
def tear_down_provider_state
|
21
22
|
if provider_state_name
|
22
|
-
get_provider_state.tear_down
|
23
|
+
get_provider_state.tear_down(params)
|
23
24
|
end
|
24
|
-
get_consumer_base_provider_state.tear_down
|
25
|
-
get_global_base_provider_state.tear_down
|
25
|
+
get_consumer_base_provider_state.tear_down(params)
|
26
|
+
get_global_base_provider_state.tear_down(params)
|
26
27
|
end
|
27
28
|
|
28
29
|
def get_provider_state
|
@@ -36,7 +37,6 @@ module Pact
|
|
36
37
|
def get_global_base_provider_state
|
37
38
|
Pact.provider_world.provider_states.get_base
|
38
39
|
end
|
39
|
-
|
40
40
|
end
|
41
41
|
end
|
42
|
-
end
|
42
|
+
end
|
@@ -5,7 +5,7 @@ module Pact
|
|
5
5
|
module State
|
6
6
|
class SetUp
|
7
7
|
def self.call provider_state_name, consumer, options = {}
|
8
|
-
State::ProviderStateManager.new(provider_state_name, consumer).set_up_provider_state
|
8
|
+
State::ProviderStateManager.new(provider_state_name, options[:params], consumer).set_up_provider_state
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -5,7 +5,7 @@ module Pact
|
|
5
5
|
module State
|
6
6
|
class TearDown
|
7
7
|
def self.call provider_state_name, consumer, options = {}
|
8
|
-
State::ProviderStateManager.new(provider_state_name, consumer).tear_down_provider_state
|
8
|
+
State::ProviderStateManager.new(provider_state_name, options[:params], consumer).tear_down_provider_state
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -35,12 +35,16 @@ module Pact
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
def
|
39
|
-
|
38
|
+
def set_up_provider_states provider_states, consumer, options = {}
|
39
|
+
provider_states.each do | provider_state |
|
40
|
+
Pact.configuration.provider_state_set_up.call(provider_state.name, consumer, options.merge(params: provider_state.params))
|
41
|
+
end
|
40
42
|
end
|
41
43
|
|
42
|
-
def
|
43
|
-
|
44
|
+
def tear_down_provider_states provider_states, consumer, options = {}
|
45
|
+
provider_states.reverse.each do | provider_state |
|
46
|
+
Pact.configuration.provider_state_tear_down.call(provider_state.name, consumer, options.merge(params: provider_state.params))
|
47
|
+
end
|
44
48
|
end
|
45
49
|
|
46
50
|
def set_metadata example, key, value
|
data/lib/pact/version.rb
CHANGED
data/pact.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |gem|
|
|
28
28
|
gem.add_runtime_dependency 'webrick'
|
29
29
|
gem.add_runtime_dependency 'term-ansicolor', '~> 1.0'
|
30
30
|
|
31
|
-
gem.add_runtime_dependency 'pact-support', '~> 1.
|
31
|
+
gem.add_runtime_dependency 'pact-support', '~> 1.8'
|
32
32
|
gem.add_runtime_dependency 'pact-mock_service', '~> 2.10'
|
33
33
|
|
34
34
|
gem.add_development_dependency 'rake', '~> 10.0.3'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pact
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.36.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Fraser
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2018-
|
15
|
+
date: 2018-10-03 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: randexp
|
@@ -124,14 +124,14 @@ dependencies:
|
|
124
124
|
requirements:
|
125
125
|
- - "~>"
|
126
126
|
- !ruby/object:Gem::Version
|
127
|
-
version: '1.
|
127
|
+
version: '1.8'
|
128
128
|
type: :runtime
|
129
129
|
prerelease: false
|
130
130
|
version_requirements: !ruby/object:Gem::Requirement
|
131
131
|
requirements:
|
132
132
|
- - "~>"
|
133
133
|
- !ruby/object:Gem::Version
|
134
|
-
version: '1.
|
134
|
+
version: '1.8'
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: pact-mock_service
|
137
137
|
requirement: !ruby/object:Gem::Requirement
|