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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d30e4cc422b899773c2917361c59ad211792f922
4
- data.tar.gz: e20e3a998c5ba7f018b615567718193e009bcd26
3
+ metadata.gz: a641a88b589e629a6991b1d4f03486bbf25457c8
4
+ data.tar.gz: bfe932a2a9ea158088c848ddeda4eeb02d0d55dd
5
5
  SHA512:
6
- metadata.gz: 3e8e7a5188f514b4c5b47de5e3a5005f863544b1625a8bf932a84ac6a700b8d5926ef87c7bfd35dbe56b7c3579ba7793d9704a64f8eae4592c73b2408696316c
7
- data.tar.gz: 095ec74b09b3ffa4bce8212d495eb88d93ee69723997d58c2d836be356493fed9bf1b17f0a4e5150f81845cdc67fdf8639598ca5ea9c1e0f9e982bfd5627bfde
6
+ metadata.gz: 5c219a9254a8eb62cc3c3c2216dcc83e734acf4ff04bdd17f96670fa6f1d3ed7cc372d14154acda42719a4c3e142e38acd24b441d762256919009a801e6a4168
7
+ data.tar.gz: 7ff96f3a742321247936a84fca00c2f33065f2558d8bafa4126981be51d96403e52988fa59576979bef0e12b82f5239a76699169e14717bf253c6b8e17934f23
@@ -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)
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Pact
2
2
  module Support
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.1"
4
4
  end
5
5
  end
@@ -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 the content-type" do
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 content-type header (" do
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.0
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-13 00:00:00.000000000 Z
15
+ date: 2015-02-24 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: randexp