pact 1.0.18 → 1.0.19
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/CHANGELOG.md +6 -2
- data/Gemfile.lock +1 -1
- data/README.md +10 -3
- data/lib/pact/provider/request.rb +5 -1
- data/lib/pact/version.rb +1 -1
- data/spec/lib/pact/provider/request_spec.rb +2 -2
- metadata +3 -9
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,13 +2,17 @@ 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.19 (29 October 2013)
|
6
|
+
* e4b990e - Gsub '-' to '_' in request headers. (Sebastian Glazebrook, 4 minutes ago)
|
7
|
+
* 52ac8f8 - Added documentation for PACT_DESCRIPTION and PACT_PROVIDER_STATE to README. (Beth, 13 hours ago)
|
8
|
+
|
5
9
|
### 1.0.18 (29 October 2013)
|
6
10
|
|
7
|
-
* f2892d4 - Fixed bug where an exception is thrown when a key is not found and is attempted to be matched to a regexp (Beth, 60 seconds ago)
|
11
|
+
* f2892d4 - Fixed bug where an exception is thrown when a key is not found and is attempted to be matched to a regexp (Beth, 60 seconds ago)
|
8
12
|
|
9
13
|
### 1.0.17 (29 October 2013)
|
10
14
|
|
11
|
-
* 74bdf09 - Added missing require for Regexp json deserialisation (Beth, 3 minutes ago)
|
15
|
+
* 74bdf09 - Added missing require for Regexp json deserialisation (Beth, 3 minutes ago)
|
12
16
|
* d69482e - Removed JsonWarning for ActiveSupport JSON. (Beth, 3 hours ago)
|
13
17
|
* 5f72720 - Fixing ALL THE REGEXPS that ActiveSupport JSON broke. The pact gem should now serialise and deserialise its own JSON properly even when ActiveSupport is loaded by the call
|
14
18
|
* c3e6430 - Added config.ru parsing to best practices. (Beth, 9 hours ago)
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -284,13 +284,20 @@ end
|
|
284
284
|
|
285
285
|
Be aware that the Rack::Builder.parse_file seems to require files even if they have already been required, so make sure your boot files are idempotent.
|
286
286
|
|
287
|
-
####
|
287
|
+
#### Use the real database
|
288
288
|
|
289
|
-
This is the best time for you to test your database integration. If you stub your database calls, you are getting little more assurance that the real end-to-end will work than if you'd used a unit test. It's the appropriate time to incur the overhead of a database call.
|
289
|
+
Do not stub your database calls for pact:verify. This is the best time for you to test your database integration. If you stub your database calls, you are getting little more assurance that the real end-to-end will work than if you'd used a unit test. It's the appropriate time to incur the overhead of a database call.
|
290
290
|
|
291
291
|
## Advanced
|
292
292
|
|
293
|
+
### Filtering the pact:verify specs
|
294
|
+
|
295
|
+
To execute a subset of the specs when running any of the pact verification tasks, define the environment variables PACT_DESCRIPTION and/or PACT_PROVIDER_STATE.
|
296
|
+
|
297
|
+
$ PACT_DESCRIPTION="a request for something" PACT_PROVIDER_STATE="something exists" rake pact:verify
|
298
|
+
|
293
299
|
### Running a standalone mock server
|
300
|
+
|
294
301
|
A pact service can be run locally and is really useful for debugging purposes.
|
295
302
|
|
296
303
|
$ bundle exec pact service -p <port-num>
|
@@ -298,7 +305,7 @@ A pact service can be run locally and is really useful for debugging purposes.
|
|
298
305
|
The service prints messages it recieves to stdout which can be really useful
|
299
306
|
when diagnosing issues with pacts.
|
300
307
|
|
301
|
-
###
|
308
|
+
### Pact file write mode
|
302
309
|
|
303
310
|
By default, the pact file will be overwritten (started from scratch) every time any rspec runs any spec using pacts. This means that if there are interactions that haven't been executed in the most recent rspec run, they are effectively removed from the pact file. If you have long running pact specs (e.g. they are generated using the browser with Capybara) and you are developing both consumer and provider in parallel, or trying to fix a broken interaction, it can be tedius to run all the specs at once. In this scenario, you can set the pactfile_write_mode to :update. This will keep all existing interactions, and update only the changed ones, identified by description and provider state. The down side of this is that if either of those fields change, the old interactions will not be removed from the pact file. As a middle path, you can set pactfile_write_mode to :smart. This will use :overwrite mode when running rake (as determined by a call to system using 'ps') and :update when running an individual spec.
|
304
311
|
|
@@ -36,7 +36,7 @@ module Pact
|
|
36
36
|
if key.match(/CONTENT.TYPE/)
|
37
37
|
request_headers['CONTENT_TYPE'] = value
|
38
38
|
else
|
39
|
-
request_headers[
|
39
|
+
request_headers[formatted_request_header_key(key)] = value
|
40
40
|
end
|
41
41
|
end
|
42
42
|
request_headers
|
@@ -53,6 +53,10 @@ module Pact
|
|
53
53
|
JSON.dump(rb)
|
54
54
|
end
|
55
55
|
end
|
56
|
+
|
57
|
+
def formatted_request_header_key(key)
|
58
|
+
'HTTP_' + key.to_s.gsub('-', '_')
|
59
|
+
end
|
56
60
|
end
|
57
61
|
end
|
58
62
|
end
|
data/lib/pact/version.rb
CHANGED
@@ -62,8 +62,8 @@ describe Pact::Provider::Request::Replayable do
|
|
62
62
|
|
63
63
|
describe "headers" do
|
64
64
|
context "when headers are expected" do
|
65
|
-
let(:headers) { {"Content-Type" => "text/plain", "Accept" => "application/json"} }
|
66
|
-
let(:expected_headers) { {"CONTENT_TYPE" => "text/plain", "HTTP_ACCEPT" => "application/json"} }
|
65
|
+
let(:headers) { {"Content-Type" => "text/plain", "Accept" => "application/json", "Access-Control-Request-Method" => "POST"} }
|
66
|
+
let(:expected_headers) { {"CONTENT_TYPE" => "text/plain", "HTTP_ACCEPT" => "application/json", "HTTP_ACCESS_CONTROL_REQUEST_METHOD" => "POST"} }
|
67
67
|
it "transforms the headers into Rack format" do
|
68
68
|
expect(subject.headers).to eq( expected_headers )
|
69
69
|
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.19
|
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-10-
|
16
|
+
date: 2013-10-30 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: randexp
|
@@ -430,21 +430,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
430
430
|
- - ! '>='
|
431
431
|
- !ruby/object:Gem::Version
|
432
432
|
version: '0'
|
433
|
-
segments:
|
434
|
-
- 0
|
435
|
-
hash: -1950289785278429589
|
436
433
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
437
434
|
none: false
|
438
435
|
requirements:
|
439
436
|
- - ! '>='
|
440
437
|
- !ruby/object:Gem::Version
|
441
438
|
version: '0'
|
442
|
-
segments:
|
443
|
-
- 0
|
444
|
-
hash: -1950289785278429589
|
445
439
|
requirements: []
|
446
440
|
rubyforge_project:
|
447
|
-
rubygems_version: 1.8.
|
441
|
+
rubygems_version: 1.8.25
|
448
442
|
signing_key:
|
449
443
|
specification_version: 3
|
450
444
|
summary: Define a pact between service consumers and providers
|