pact-support 0.6.1 → 1.0.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 +4 -0
- data/lib/pact/helpers.rb +9 -0
- data/lib/pact/shared/request.rb +1 -1
- data/lib/pact/support/version.rb +1 -1
- data/spec/lib/pact/consumer_contract/request_spec.rb +2 -2
- data/spec/lib/pact/helpers_spec.rb +51 -0
- 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: 597b03ac1e0725efd9f2d4d464358a3ad9dc206f
|
4
|
+
data.tar.gz: 21ea01bcd12d457d9574e17b7782c6d9f6f7c8f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ada4d2046f3f14031caa21187b76916cf424282948b1854253392c752183da026d1f6a70bf550606fc192f03c4f3231b648c36b88d19d9c0d0d0e6e0fab02e5
|
7
|
+
data.tar.gz: 846f36f9986128c71aefe6548ca1f6920abe69589a1e859e6009654cd29f3651372b7311ef51329380e7e809f4c27a23c1227814c77ef1ebbdcde1e1de16a1ef
|
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)' vX.Y.Z..HEAD
|
4
4
|
|
5
|
+
### 1.0.0 (12 Apr 2017)
|
6
|
+
* 0ad2ef5 - Stop removing trailing slash from path, as per https://github.com/pact-foundation/pact-specification/blob/version-2/testcases/request/path/missing%20trailing%20slash%20in%20path.json (Beth Skurrie, Wed Apr 12 14:59:04 2017 +1000)
|
7
|
+
* 7f93c00 - add a helper to match a non iso861 datetime string (Courtney Braafhart, Thu Apr 6 12:18:53 2017 -0500)
|
8
|
+
|
5
9
|
### 0.6.1 (10 Mar 2017)
|
6
10
|
* 4627b56 - Explicit require of CGI class. (Tan Le, Thu Mar 9 17:01:37 2017 +1100)
|
7
11
|
* 26b6678 - Added colon support to matching rules path. (soundstep, Wed Mar 8 09:18:35 2017 +0000)
|
data/lib/pact/helpers.rb
CHANGED
@@ -45,5 +45,14 @@ module Pact
|
|
45
45
|
Pact::Term.new(generate: date, matcher: /^\d{4}-[01]\d-[0-3]\d$/)
|
46
46
|
end
|
47
47
|
|
48
|
+
def like_datetime_rfc822 datetime
|
49
|
+
Pact::Term.new(
|
50
|
+
generate: datetime,
|
51
|
+
matcher: /(?x)(Mon|Tue|Wed|Thu|Fri|Sat|Sun),
|
52
|
+
\s\d{2}\s
|
53
|
+
(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)
|
54
|
+
\s\d{4}\s\d{2}:\d{2}:\d{2}\s(\+|-)\d{4}/
|
55
|
+
)
|
56
|
+
end
|
48
57
|
end
|
49
58
|
end
|
data/lib/pact/shared/request.rb
CHANGED
@@ -16,7 +16,7 @@ module Pact
|
|
16
16
|
|
17
17
|
def initialize(method, path, headers, body, query)
|
18
18
|
@method = method.to_s
|
19
|
-
@path = path
|
19
|
+
@path = path
|
20
20
|
@headers = Hash === headers ? Headers.new(headers) : headers # Could be a NullExpectation - TODO make this more elegant
|
21
21
|
@body = body
|
22
22
|
@query = is_unspecified?(query) ? query : Pact::Query.create(query)
|
data/lib/pact/support/version.rb
CHANGED
@@ -120,8 +120,8 @@ module Pact
|
|
120
120
|
let(:expected_path) { '/foo' }
|
121
121
|
let(:actual_path) { '/foo/' }
|
122
122
|
|
123
|
-
it "
|
124
|
-
expect(subject.matches? actual_request).to be
|
123
|
+
it "does not match" do
|
124
|
+
expect(subject.matches? actual_request).to be false
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
@@ -87,6 +87,57 @@ module Pact
|
|
87
87
|
matcher: /^\d{4}-[01]\d-[0-3]\d$/
|
88
88
|
)
|
89
89
|
end
|
90
|
+
|
91
|
+
describe "#like_datetime_rfc822" do
|
92
|
+
context "Day is Tue" do
|
93
|
+
let(:datetime) { 'Tue, 04 Apr 2017 19:03:19 +0000' }
|
94
|
+
it "creates a Pact::Term with a rfc922 matcher" do
|
95
|
+
expect(like_datetime_rfc822(datetime)).to eq Pact::Term.new(
|
96
|
+
generate: datetime,
|
97
|
+
matcher: /(?x)(Mon|Tue|Wed|Thu|Fri|Sat|Sun),
|
98
|
+
\s\d{2}\s
|
99
|
+
(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)
|
100
|
+
\s\d{4}\s\d{2}:\d{2}:\d{2}\s(\+|-)\d{4}/)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
context "Day is Sun" do
|
105
|
+
let(:datetime) { 'Sun, 09 Apr 2017 19:03:19 +0000' }
|
106
|
+
it "creates a Pact::Term with a rfc922 matcher" do
|
107
|
+
expect(like_datetime_rfc822(datetime)).to eq Pact::Term.new(
|
108
|
+
generate: datetime,
|
109
|
+
matcher: /(?x)(Mon|Tue|Wed|Thu|Fri|Sat|Sun),
|
110
|
+
\s\d{2}\s
|
111
|
+
(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)
|
112
|
+
\s\d{4}\s\d{2}:\d{2}:\d{2}\s(\+|-)\d{4}/)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
context "Month is Jan" do
|
117
|
+
let(:datetime) { 'Mon, 02 Jan 2017 19:03:19 +0000' }
|
118
|
+
it "creates a Pact::Term with a rfc922 matcher" do
|
119
|
+
expect(like_datetime_rfc822(datetime)).to eq Pact::Term.new(
|
120
|
+
generate: datetime,
|
121
|
+
matcher: /(?x)(Mon|Tue|Wed|Thu|Fri|Sat|Sun),
|
122
|
+
\s\d{2}\s
|
123
|
+
(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)
|
124
|
+
\s\d{4}\s\d{2}:\d{2}:\d{2}\s(\+|-)\d{4}/)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
context "Negative Offset" do
|
129
|
+
let(:datetime) { 'Mon, 31 Oct 2016 15:21:41 -0400' }
|
130
|
+
it "creates a Pact::Term with a rfc922 matcher" do
|
131
|
+
expect(like_datetime_rfc822(datetime)).to eq Pact::Term.new(
|
132
|
+
generate: datetime,
|
133
|
+
matcher: /(?x)(Mon|Tue|Wed|Thu|Fri|Sat|Sun),
|
134
|
+
\s\d{2}\s
|
135
|
+
(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)
|
136
|
+
\s\d{4}\s\d{2}:\d{2}:\d{2}\s(\+|-)\d{4}/)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
end
|
90
141
|
end
|
91
142
|
end
|
92
143
|
end
|
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.
|
4
|
+
version: 1.0.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: 2017-
|
15
|
+
date: 2017-04-12 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: randexp
|