pact 1.0.27 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +7 -1
- data/Gemfile.lock +1 -1
- data/lib/pact/provider/provider_state.rb +12 -9
- data/lib/pact/provider/provider_state_proxy.rb +1 -1
- data/lib/pact/provider/rspec.rb +2 -2
- data/lib/pact/version.rb +1 -1
- data/spec/features/production_spec.rb +3 -3
- data/spec/lib/pact/provider/provider_state_proxy_spec.rb +2 -2
- data/spec/lib/pact/provider/provider_state_spec.rb +8 -8
- metadata +4 -4
data/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,13 @@ Do this to generate your change history
|
|
|
2
2
|
|
|
3
3
|
git log --date=relative --pretty=format:' * %h - %s (%an, %ad)'
|
|
4
4
|
|
|
5
|
-
### 1.0.
|
|
5
|
+
### 1.0.28 (11 December 2013)
|
|
6
|
+
|
|
7
|
+
* 24f9ea0 - Changed provider set up and tear down back to running in before :each, as rspec stubbing is not supported in before :all (Beth, 15 seconds ago)
|
|
8
|
+
* 825e787 - Fixing failing tests (Beth, 4 hours ago)
|
|
9
|
+
* fb6a1c8 - Moving ProviderState collection into its own class (Beth, 6 hours ago)
|
|
10
|
+
|
|
11
|
+
### 1.0.27 (10 December 2013)
|
|
6
12
|
|
|
7
13
|
* 388fc7b - Changing provider set up and tear down to run before :all rather than before :each (Beth, 13 minutes ago)
|
|
8
14
|
* 06b5626 - Updating TODO list in the README. (Beth, 25 hours ago)
|
data/Gemfile.lock
CHANGED
|
@@ -3,21 +3,17 @@ module Pact
|
|
|
3
3
|
|
|
4
4
|
module DSL
|
|
5
5
|
def provider_state name, &block
|
|
6
|
-
|
|
6
|
+
ProviderStates.provider_state(name, &block).register
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def provider_states_for name, &block
|
|
10
|
-
|
|
10
|
+
ProviderStates.current_namespaces << name
|
|
11
11
|
instance_eval(&block)
|
|
12
|
-
|
|
12
|
+
ProviderStates.current_namespaces.pop
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
class
|
|
17
|
-
|
|
18
|
-
attr_accessor :name
|
|
19
|
-
attr_accessor :namespace
|
|
20
|
-
|
|
16
|
+
class ProviderStates
|
|
21
17
|
def self.provider_state name, &block
|
|
22
18
|
ProviderState.new(name, current_namespaces.join('.'), &block)
|
|
23
19
|
end
|
|
@@ -38,9 +34,16 @@ module Pact
|
|
|
38
34
|
fullname = options[:for] ? "#{options[:for]}.#{name}" : name
|
|
39
35
|
(provider_states[fullname] || provider_states[fullname.to_sym]) || provider_states[name]
|
|
40
36
|
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
class ProviderState
|
|
40
|
+
|
|
41
|
+
attr_accessor :name
|
|
42
|
+
attr_accessor :namespace
|
|
43
|
+
|
|
41
44
|
|
|
42
45
|
def register
|
|
43
|
-
|
|
46
|
+
ProviderStates.register(namespaced(name), self)
|
|
44
47
|
end
|
|
45
48
|
|
|
46
49
|
def initialize name, namespace, &block
|
|
@@ -9,7 +9,7 @@ module Pact
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def get name, options = {}
|
|
12
|
-
unless provider_state =
|
|
12
|
+
unless provider_state = ProviderStates.get(name, options)
|
|
13
13
|
register_missing_provider_state name, options[:for]
|
|
14
14
|
raise error_message name, options[:for]
|
|
15
15
|
end
|
data/lib/pact/provider/rspec.rb
CHANGED
|
@@ -62,12 +62,12 @@ module Pact
|
|
|
62
62
|
|
|
63
63
|
describe description_for(interaction), :pact => :verify do
|
|
64
64
|
|
|
65
|
-
before
|
|
65
|
+
before do
|
|
66
66
|
set_up_provider_state interaction.provider_state, options[:consumer]
|
|
67
67
|
replay_interaction interaction
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
-
after
|
|
70
|
+
after do
|
|
71
71
|
tear_down_provider_state interaction.provider_state, options[:consumer]
|
|
72
72
|
end
|
|
73
73
|
|
data/lib/pact/version.rb
CHANGED
|
@@ -75,7 +75,7 @@ module Pact::Provider
|
|
|
75
75
|
}
|
|
76
76
|
EOS
|
|
77
77
|
|
|
78
|
-
before do
|
|
78
|
+
before :all do
|
|
79
79
|
Pact.service_provider "My Provider" do
|
|
80
80
|
app { ServiceUnderTest.new }
|
|
81
81
|
end
|
|
@@ -109,7 +109,7 @@ module Pact::Provider
|
|
|
109
109
|
}
|
|
110
110
|
EOS
|
|
111
111
|
|
|
112
|
-
before do
|
|
112
|
+
before :all do
|
|
113
113
|
Pact.service_provider "My Provider" do
|
|
114
114
|
app { ServiceUnderTestWithFixture.new }
|
|
115
115
|
end
|
|
@@ -141,7 +141,7 @@ module Pact::Provider
|
|
|
141
141
|
}
|
|
142
142
|
EOS
|
|
143
143
|
|
|
144
|
-
before do
|
|
144
|
+
before :all do
|
|
145
145
|
Pact.service_provider "ServiceUnderTestWithFixture" do
|
|
146
146
|
app { ServiceUnderTestWithFixture.new }
|
|
147
147
|
end
|
|
@@ -15,12 +15,12 @@ module Pact
|
|
|
15
15
|
subject { provider_state_proxy.get name, options }
|
|
16
16
|
|
|
17
17
|
before do
|
|
18
|
-
|
|
18
|
+
ProviderStates.stub(:get).and_return(provider_state)
|
|
19
19
|
end
|
|
20
20
|
context "when the provider state exists" do
|
|
21
21
|
|
|
22
22
|
it "retrieves the provider state from ProviderState" do
|
|
23
|
-
|
|
23
|
+
ProviderStates.should_receive(:get).with(name, options).and_return(provider_state)
|
|
24
24
|
subject
|
|
25
25
|
end
|
|
26
26
|
|
|
@@ -25,7 +25,7 @@ module Pact
|
|
|
25
25
|
MESSAGES.clear
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
subject {
|
|
28
|
+
subject { ProviderStates.get('no_alligators') }
|
|
29
29
|
|
|
30
30
|
describe 'set_up' do
|
|
31
31
|
it 'should call the block passed to set_up' do
|
|
@@ -44,12 +44,12 @@ module Pact
|
|
|
44
44
|
describe '.get' do
|
|
45
45
|
context 'when the name is a matching symbol' do
|
|
46
46
|
it 'will return the ProviderState' do
|
|
47
|
-
|
|
47
|
+
ProviderStates.get('no_alligators').should_not be_nil
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
context 'when the name is a matching string' do
|
|
51
51
|
it 'will return the ProviderState' do
|
|
52
|
-
|
|
52
|
+
ProviderStates.get('some alligators').should_not be_nil
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
end
|
|
@@ -61,8 +61,8 @@ module Pact
|
|
|
61
61
|
Pact.provider_state 'with_no_op' do
|
|
62
62
|
no_op
|
|
63
63
|
end
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
ProviderStates.get('with_no_op').set_up
|
|
65
|
+
ProviderStates.get('with_no_op').tear_down
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
68
|
context "when a no_op is defined with a set_up" do
|
|
@@ -118,11 +118,11 @@ module Pact
|
|
|
118
118
|
describe '.get' do
|
|
119
119
|
context 'for a consumer' do
|
|
120
120
|
it 'has a namespaced name' do
|
|
121
|
-
|
|
121
|
+
ProviderStates.get('the weather is sunny', :for => 'a consumer').should_not be_nil
|
|
122
122
|
end
|
|
123
123
|
|
|
124
124
|
it 'falls back to a global state of the same name if one is not found for the specified consumer' do
|
|
125
|
-
|
|
125
|
+
ProviderStates.get('the weather is cloudy', :for => 'a consumer').should_not be_nil
|
|
126
126
|
end
|
|
127
127
|
end
|
|
128
128
|
|
|
@@ -131,7 +131,7 @@ module Pact
|
|
|
131
131
|
describe 'set_up' do
|
|
132
132
|
context 'for a consumer' do
|
|
133
133
|
it 'runs its own setup' do
|
|
134
|
-
|
|
134
|
+
ProviderStates.get('the weather is sunny', :for => 'a consumer').set_up
|
|
135
135
|
NAMESPACED_MESSAGES.should eq ['sunny!']
|
|
136
136
|
end
|
|
137
137
|
end
|
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.0.
|
|
4
|
+
version: 1.0.28
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -13,7 +13,7 @@ authors:
|
|
|
13
13
|
autorequire:
|
|
14
14
|
bindir: bin
|
|
15
15
|
cert_chain: []
|
|
16
|
-
date: 2013-12-
|
|
16
|
+
date: 2013-12-11 00:00:00.000000000 Z
|
|
17
17
|
dependencies:
|
|
18
18
|
- !ruby/object:Gem::Dependency
|
|
19
19
|
name: randexp
|
|
@@ -434,7 +434,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
434
434
|
version: '0'
|
|
435
435
|
segments:
|
|
436
436
|
- 0
|
|
437
|
-
hash:
|
|
437
|
+
hash: -54424747332292177
|
|
438
438
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
439
439
|
none: false
|
|
440
440
|
requirements:
|
|
@@ -443,7 +443,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
443
443
|
version: '0'
|
|
444
444
|
segments:
|
|
445
445
|
- 0
|
|
446
|
-
hash:
|
|
446
|
+
hash: -54424747332292177
|
|
447
447
|
requirements: []
|
|
448
448
|
rubyforge_project:
|
|
449
449
|
rubygems_version: 1.8.23
|