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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: beef3d8d0aee405fd146512cfb49cb23b4bedadc
4
- data.tar.gz: 72981776fd3ec194c9ce6bb7017a828413159cd9
3
+ metadata.gz: 597b03ac1e0725efd9f2d4d464358a3ad9dc206f
4
+ data.tar.gz: 21ea01bcd12d457d9574e17b7782c6d9f6f7c8f8
5
5
  SHA512:
6
- metadata.gz: 2208542c71eca13d8c3bba7c78eec7c2a6fd478df0ca4ef63e70cfccb1a9bd17068513025bef9b6576962a74a35827080fd696d1d6bf77fa18b6f311b5b0dc8c
7
- data.tar.gz: 40931117ebafad7d43968eea34375b893b08336c894f7e1cb6da5f7660263f8e86c3b953970cfe463fce7ca18f2bf7bf25f7418ea380db9d9d38c4e487474411
6
+ metadata.gz: 0ada4d2046f3f14031caa21187b76916cf424282948b1854253392c752183da026d1f6a70bf550606fc192f03c4f3231b648c36b88d19d9c0d0d0e6e0fab02e5
7
+ data.tar.gz: 846f36f9986128c71aefe6548ca1f6920abe69589a1e859e6009654cd29f3651372b7311ef51329380e7e809f4c27a23c1227814c77ef1ebbdcde1e1de16a1ef
@@ -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)
@@ -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
@@ -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.respond_to?(:chomp) ? path.chomp('/') : path #TODO get rid of the chomp in v2
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)
@@ -1,5 +1,5 @@
1
1
  module Pact
2
2
  module Support
3
- VERSION = "0.6.1"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
@@ -120,8 +120,8 @@ module Pact
120
120
  let(:expected_path) { '/foo' }
121
121
  let(:actual_path) { '/foo/' }
122
122
 
123
- it "matches" do
124
- expect(subject.matches? actual_request).to be true
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.6.1
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-03-11 00:00:00.000000000 Z
15
+ date: 2017-04-12 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: randexp