pact-support 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/pact/shared/request.rb +2 -2
- data/lib/pact/support/version.rb +1 -1
- data/spec/lib/pact/consumer_contract/request_spec.rb +11 -0
- data/spec/lib/pact/shared/request_spec.rb +14 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a641a88b589e629a6991b1d4f03486bbf25457c8
|
4
|
+
data.tar.gz: bfe932a2a9ea158088c848ddeda4eeb02d0d55dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c219a9254a8eb62cc3c3c2216dcc83e734acf4ff04bdd17f96670fa6f1d3ed7cc372d14154acda42719a4c3e142e38acd24b441d762256919009a801e6a4168
|
7
|
+
data.tar.gz: 7ff96f3a742321247936a84fca00c2f33065f2558d8bafa4126981be51d96403e52988fa59576979bef0e12b82f5239a76699169e14717bf253c6b8e17934f23
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@ Do this to generate your change history
|
|
2
2
|
|
3
3
|
git log --pretty=format:' * %h - %s (%an, %ad)'
|
4
4
|
|
5
|
+
### 0.3.1 (24 Februrary 2015)
|
6
|
+
|
7
|
+
* e3d6d6d - Fixed bug when Content-Type is a Pact::Term. (Beth Skurrie, Tue Feb 24 17:25:10 2015 +1100)
|
8
|
+
|
5
9
|
### 0.3.0 (13 Februrary 2015)
|
6
10
|
|
7
11
|
* 4e29277 - Create a public API for extracting matching rules for pact-mock_service to use. (Beth Skurrie, Fri Feb 13 15:35:14 2015 +1100)
|
data/lib/pact/shared/request.rb
CHANGED
@@ -42,8 +42,8 @@ module Pact
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def content_type
|
45
|
-
return nil unless specified?(:headers)
|
46
|
-
headers['Content-Type']
|
45
|
+
return nil unless specified?(:headers) && headers['Content-Type']
|
46
|
+
Pact::Reification.from_term(headers['Content-Type'])
|
47
47
|
end
|
48
48
|
|
49
49
|
def content_type? content_type
|
data/lib/pact/support/version.rb
CHANGED
@@ -69,6 +69,17 @@ module Pact
|
|
69
69
|
expect(subject.matches? actual_request).to be true
|
70
70
|
end
|
71
71
|
|
72
|
+
context "when the Content-Type header is a Pact::Term" do
|
73
|
+
let(:expected_headers) { {'Content-Type' => Pact::Term.new(generate: 'application/json', matcher: /json/) } }
|
74
|
+
let(:expected_body) { {'foo' => 'bar'} }
|
75
|
+
let(:actual_headers) { {'Content-Type' => 'foo/json'} }
|
76
|
+
let(:actual_body) { {'foo' => 'bar'} }
|
77
|
+
|
78
|
+
it "reifies the term before matching" do
|
79
|
+
expect(subject.matches? actual_request).to be true
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
72
83
|
context "when the methods are the same but one is symbolized" do
|
73
84
|
let(:expected_method) { :get }
|
74
85
|
let(:actual_method) { 'get' }
|
@@ -104,16 +104,28 @@ module Pact
|
|
104
104
|
end
|
105
105
|
context "when there is no Content-Type header" do
|
106
106
|
let(:headers) { {} }
|
107
|
-
it "returns
|
107
|
+
it "returns nil" do
|
108
108
|
expect(subject.send(:content_type)).to be nil
|
109
109
|
end
|
110
110
|
end
|
111
|
-
context "when there is a
|
111
|
+
context "when there is a Content-Type header" do
|
112
|
+
let(:headers) { {'Content-Type' => 'blah'} }
|
113
|
+
it "returns the Content-Type" do
|
114
|
+
expect(subject.send(:content_type)).to eq 'blah'
|
115
|
+
end
|
116
|
+
end
|
117
|
+
context "when there is a content-type header" do
|
112
118
|
let(:headers) { {'content-type' => 'blah'} }
|
113
119
|
it "returns the content-type" do
|
114
120
|
expect(subject.send(:content_type)).to eq 'blah'
|
115
121
|
end
|
116
122
|
end
|
123
|
+
context "when the Content-Type header is a Pact::Term" do
|
124
|
+
let(:headers) { {'Content-Type' => Pact::Term.new(generate: 'application/json', matcher: /json/)} }
|
125
|
+
it "returns the reified Content-Type" do
|
126
|
+
expect(subject.send(:content_type)).to eq 'application/json'
|
127
|
+
end
|
128
|
+
end
|
117
129
|
end
|
118
130
|
|
119
131
|
describe "content_type?" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pact-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
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: 2015-02-
|
15
|
+
date: 2015-02-24 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: randexp
|