pact_expectations 1.1.0 → 1.2.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: c2c6097b4e1d649eb32c6f7b0d9d3bce98db3bad
4
- data.tar.gz: 0d19bd1288addfe734b378420be20e8e55a6d159
3
+ metadata.gz: 071bad902fdf801ae94635a1b9e8fe64a09717e1
4
+ data.tar.gz: 669ec332f29bf14cca1fac0303e3870384740849
5
5
  SHA512:
6
- metadata.gz: c97e2ecba7a7d1c6ff93507454287bea7f0b3f88499171a8030b768a869d865df86d53c01ad28541d90fa4be24e8d2227c3782703bdd6a58d4240b222b83b3f2
7
- data.tar.gz: 8fde5ef8ace82e754c3b569da0ea6b0c802617e34d437db589b9f07ae8648da636057413a1bb3585a0ed7039bcbb93419a594c0a0812fc0ad0d751df8295f634
6
+ metadata.gz: 5de3c70692164d7181c452ea1cf94b77bb992cc38df7c199453d15fa04c3bd81a5333250f2131efb083737095a79957584e806f66dd28ebdc1ea998c008d752f
7
+ data.tar.gz: 1d88431ffe1caabd2b9b66e6e0613e92b5be497dddd2b25c878d50753e8db52f4441c1dadf0f70268e20c87b2cfe70f2d978a01c749936d81ef1dd05aed46c02
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ spec/examples.txt
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
- --format documentation
2
1
  --color
2
+ --require spec_helper
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.8
4
3
  - 2.2.4
5
4
  - 2.3.0
6
5
  before_install: gem install bundler -v 1.11.2
@@ -1,8 +1,52 @@
1
- require "pact_expectations/version"
2
- require "pact/support/version"
3
1
  require "set"
2
+ require "pact/support"
3
+
4
+ require "pact_expectations/version"
4
5
 
5
6
  class PactExpectations
7
+ class Error < ::StandardError
8
+ end
9
+ class NotFound < Error
10
+ end
11
+
12
+ class DuplicatedKey < Error
13
+ end
14
+
15
+ class ExpectationNotCalled < Error
16
+ def initialize(not_call_responses = [], not_call_reificated = [])
17
+ @not_call_responses = not_call_responses
18
+ @not_call_reificated = not_call_reificated
19
+ end
20
+
21
+ def message
22
+ message = String.new("\n")
23
+ unless @not_call_responses.empty?
24
+ message << create_not_call_message(
25
+ "Some expectations were defined but not used to construct the Contract",
26
+ @not_call_responses
27
+ )
28
+ end
29
+ unless @not_call_reificated.empty?
30
+ message << create_not_call_message(
31
+ "Some expectations were defined but not used to stub Remote Facade",
32
+ @not_call_reificated
33
+ )
34
+ end
35
+ message
36
+ end
37
+
38
+ private
39
+
40
+ def create_not_call_message(title, list)
41
+ message = String.new("#{title}:\n")
42
+ list.each do |key|
43
+ message << "- #{key}\n"
44
+ end
45
+ message << "\n"
46
+ end
47
+ end
48
+ VerifyError = ExpectationNotCalled # For backward-compatibility
49
+
6
50
  class << self
7
51
  def add_response_body_for(key, expectation = {})
8
52
  raise DuplicatedKey if expectations.include?(key)
@@ -26,7 +70,7 @@ class PactExpectations
26
70
  not_call_reificated = reificated_call ^ expectations.keys
27
71
 
28
72
  if !not_call_responses.empty? || !not_call_reificated.empty?
29
- raise VerifyError.new(not_call_responses, not_call_reificated)
73
+ raise ExpectationNotCalled.new(not_call_responses, not_call_reificated)
30
74
  end
31
75
  end
32
76
 
@@ -51,38 +95,3 @@ class PactExpectations
51
95
  end
52
96
  end
53
97
  end
54
- class PactExpectations::NotFound < StandardError; end
55
- class PactExpectations::DuplicatedKey < StandardError; end
56
- class PactExpectations::VerifyError < StandardError
57
- def initialize(not_call_responses = [], not_call_reificated = [])
58
- @not_call_responses = not_call_responses
59
- @not_call_reificated = not_call_reificated
60
- end
61
-
62
- def message
63
- message = String.new("\n")
64
- unless @not_call_responses.empty?
65
- message << create_not_call_message(
66
- "Some expectations were defined but not used to construct the Contract",
67
- @not_call_responses
68
- )
69
- end
70
- unless @not_call_reificated.empty?
71
- message << create_not_call_message(
72
- "Some expectations were defined but not used to stub Remote Facade",
73
- @not_call_reificated
74
- )
75
- end
76
- message
77
- end
78
-
79
- private
80
-
81
- def create_not_call_message(title, list)
82
- message = String.new("#{title}:\n")
83
- list.each do |key|
84
- message << "- #{key}\n"
85
- end
86
- message << "\n"
87
- end
88
- end
@@ -1,3 +1,3 @@
1
1
  class PactExpectations
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Yoshiori SHOJI"]
10
10
  spec.email = ["yoshiori@gmail.com"]
11
11
 
12
- spec.summary = %q{Pact response convert to stub.}
12
+ spec.summary = %q{Manage and convert Pact expectations to stubs for Remote Facade.}
13
13
  spec.description = spec.summary
14
14
  spec.homepage = "https://github.com/yoshiori/pact_expectations"
15
15
  spec.license = "MIT"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact_expectations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshiori SHOJI
@@ -80,7 +80,7 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.0'
83
- description: Pact response convert to stub.
83
+ description: Manage and convert Pact expectations to stubs for Remote Facade.
84
84
  email:
85
85
  - yoshiori@gmail.com
86
86
  executables: []
@@ -120,5 +120,5 @@ rubyforge_project:
120
120
  rubygems_version: 2.5.1
121
121
  signing_key:
122
122
  specification_version: 4
123
- summary: Pact response convert to stub.
123
+ summary: Manage and convert Pact expectations to stubs for Remote Facade.
124
124
  test_files: []