pact-mock_service 2.9.8 → 2.10.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 +9 -0
- data/lib/pact/mock_service/client.rb +10 -5
- data/lib/pact/mock_service/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57000d6eb45cb2bdbcc12574580ed0b3e8d31d6672f36d7cde35e8046f11e8b3
|
4
|
+
data.tar.gz: bad5df5331628319986fa2ce5f6af4a01cf923301c3cd4bb4c1e201d683c8dee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1da9592af74aa18e461ce0fb9a13946a0c93cce203d546fef866c6ead81944682c870aa0d296d0196ade06b4d6c682fb4e72641e2d8ea9cff56f75a375b86f3
|
7
|
+
data.tar.gz: 5920dcc583bb909a120eb00ab761205a7a3539922a426257692ccecec00d594bdb2d451ff49f1452598108761b399ab4d2d1a391da85b4e707eede912837589e
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
require 'net/http'
|
2
2
|
require 'pact/mock_service/interaction_decorator'
|
3
|
+
require 'pact/errors'
|
3
4
|
|
4
5
|
module Pact
|
5
6
|
module MockService
|
7
|
+
|
8
|
+
class VerificationFailedError < Pact::Error; end
|
9
|
+
class AddInteractionError < Pact::Error; end
|
10
|
+
class WritePactError < Pact::Error; end
|
11
|
+
|
6
12
|
class Client
|
7
13
|
|
8
14
|
MOCK_SERVICE_ADMINISTRATON_HEADERS = {'X-Pact-Mock-Service' => 'true'}
|
@@ -13,7 +19,7 @@ module Pact
|
|
13
19
|
|
14
20
|
def verify example_description
|
15
21
|
response = http.request_get("/interactions/verification?example_description=#{CGI.escape(example_description)}", MOCK_SERVICE_ADMINISTRATON_HEADERS)
|
16
|
-
raise "\e[31m#{response.body}\e[m" unless response.is_a? Net::HTTPSuccess
|
22
|
+
raise VerificationFailedError.new("\e[31m#{response.body}\e[m") unless response.is_a? Net::HTTPSuccess
|
17
23
|
end
|
18
24
|
|
19
25
|
def log msg
|
@@ -37,7 +43,7 @@ module Pact
|
|
37
43
|
interaction_json(interaction),
|
38
44
|
MOCK_SERVICE_ADMINISTRATON_HEADERS.merge("Content-Type" => "application/json")
|
39
45
|
)
|
40
|
-
raise "\e[31m#{response.body}\e[m" unless response.is_a? Net::HTTPSuccess
|
46
|
+
raise AddInteractionError.new("\e[31m#{response.body}\e[m") unless response.is_a? Net::HTTPSuccess
|
41
47
|
end
|
42
48
|
|
43
49
|
def self.clear_interactions port, example_description
|
@@ -46,7 +52,7 @@ module Pact
|
|
46
52
|
|
47
53
|
def write_pact pacticipant_details
|
48
54
|
response = http.request_post("/pact", pacticipant_details.to_json, MOCK_SERVICE_ADMINISTRATON_HEADERS.merge("Content-Type" => "application/json"))
|
49
|
-
raise "\e[31m#{response.body}\e[m" unless response.is_a? Net::HTTPSuccess
|
55
|
+
raise WritePactError.new("\e[31m#{response.body}\e[m") unless response.is_a? Net::HTTPSuccess
|
50
56
|
response.body
|
51
57
|
end
|
52
58
|
|
@@ -67,7 +73,6 @@ module Pact
|
|
67
73
|
def interaction_json interaction
|
68
74
|
Pact::MockService::InteractionDecorator.new(interaction).to_json
|
69
75
|
end
|
70
|
-
|
71
76
|
end
|
72
77
|
end
|
73
|
-
end
|
78
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pact-mock_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.10.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: 2018-
|
15
|
+
date: 2018-08-06 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rack
|