pact-support 1.21.7 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/pact/consumer_contract/file_name.rb +1 -1
- data/lib/pact/consumer_contract/http_consumer_contract_parser.rb +1 -1
- data/lib/pact/consumer_contract/interaction_v3_parser.rb +1 -1
- data/lib/pact/consumer_contract/pact_file.rb +5 -5
- data/lib/pact/consumer_contract/query_hash.rb +1 -1
- data/lib/pact/consumer_contract/query_string.rb +1 -1
- data/lib/pact/consumer_contract/request.rb +3 -3
- data/lib/pact/logging.rb +2 -2
- data/lib/pact/matchers/embedded_diff_formatter.rb +1 -1
- data/lib/pact/matchers/matchers.rb +2 -2
- data/lib/pact/matchers/unix_diff_formatter.rb +3 -3
- data/lib/pact/matching_rules/merge.rb +1 -1
- data/lib/pact/matching_rules/v3/merge.rb +1 -1
- data/lib/pact/shared/active_support_support.rb +3 -3
- data/lib/pact/shared/form_differ.rb +1 -1
- data/lib/pact/shared/json_differ.rb +1 -1
- data/lib/pact/shared/multipart_form_differ.rb +1 -1
- data/lib/pact/shared/text_differ.rb +1 -1
- data/lib/pact/support/configuration.rb +198 -0
- data/lib/pact/{generators.rb → support/generators.rb} +2 -0
- data/lib/pact/support/rspec.rb +54 -0
- data/lib/pact/support/version.rb +1 -1
- data/lib/pact/support.rb +2 -2
- metadata +26 -6
- data/lib/pact/configuration.rb +0 -196
- data/lib/pact/rspec.rb +0 -51
- /data/lib/pact/{matchers.rb → support/matchers.rb} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 98d34d97e45da900f702aa3eaf63f1939bbe11acf73b58d314bf6f52435d6bf7
|
|
4
|
+
data.tar.gz: d40f883a5dff594d37eaf2f16144009456ff714ff9e0de2e0960fdd352a70613
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e354664620c36e5140046d6962db6101020ff1a1cf04e3add59bd2270bc029536e01bbe02fbcec38c79adb66e011d4428ea76d6de70ee709aaad1e9a3d211fa3
|
|
7
|
+
data.tar.gz: 9dfe86f4b977b410251325356963b8de961d3061855f08b9a550f6d9503ca4bee8cf8bc8bb4621e92b0d698db0f2f5639d99b1bd4d26a0c02d9c247c4c310659
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
<a name="v2.0.0"></a>
|
|
2
|
+
### v2.0.0 (2026-09-12)
|
|
3
|
+
|
|
4
|
+
#### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps**
|
|
7
|
+
* bump json dep ([7cd5e81](/../../commit/7cd5e81))
|
|
8
|
+
|
|
9
|
+
* move pact/rspec to pact/support/rspec ([4745275](/../../commit/4745275))
|
|
10
|
+
|
|
1
11
|
<a name="v1.21.7"></a>
|
|
2
12
|
### v1.21.7 (2026-07-21)
|
|
3
13
|
|
|
@@ -7,7 +7,7 @@ module Pact
|
|
|
7
7
|
"#{filenamify(consumer_name)}-#{filenamify(provider_name)}#{pid}.json"
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
-
def file_path consumer_name, provider_name, pact_dir = Pact.configuration.pact_dir, options = {}
|
|
10
|
+
def file_path consumer_name, provider_name, pact_dir = Pact::Support.configuration.pact_dir, options = {}
|
|
11
11
|
File.join(windows_safe(pact_dir), file_name(consumer_name, provider_name, options))
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -10,7 +10,7 @@ module Pact
|
|
|
10
10
|
options = { pact_specification_version: v }
|
|
11
11
|
|
|
12
12
|
if v.after? 3
|
|
13
|
-
Pact.configuration.error_stream.puts "WARN: This code only knows how to parse v3 pacts, attempting to parse v#{options[:pact_specification_version]} pact using v3 code."
|
|
13
|
+
Pact::Support.configuration.error_stream.puts "WARN: This code only knows how to parse v3 pacts, attempting to parse v#{options[:pact_specification_version]} pact using v3 code."
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
interactions = hash[:interactions].each_with_index.collect { |hash, index| Interaction.from_hash({ index: index }.merge(hash), options) }
|
|
@@ -17,7 +17,7 @@ module Pact
|
|
|
17
17
|
provider_states = parse_provider_states(hash['providerStates'])
|
|
18
18
|
provider_state = provider_states.any? ? provider_states.first.name : nil
|
|
19
19
|
if provider_states && provider_states.size > 1
|
|
20
|
-
Pact.configuration.error_stream.puts("WARN: Currently only 1 provider state is supported. Ignoring ")
|
|
20
|
+
Pact::Support.configuration.error_stream.puts("WARN: Currently only 1 provider state is supported. Ignoring ")
|
|
21
21
|
end
|
|
22
22
|
metadata = parse_metadata(hash['metadata'])
|
|
23
23
|
Interaction.new(symbolize_keys(hash).merge(request: request,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require "net/http"
|
|
2
|
-
require "pact/configuration"
|
|
2
|
+
require "pact/support/configuration"
|
|
3
3
|
require "pact/http/authorization_header_redactor"
|
|
4
4
|
|
|
5
5
|
module Pact
|
|
@@ -33,8 +33,8 @@ module Pact
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def save_pactfile_to_tmp pact, name
|
|
36
|
-
::FileUtils.mkdir_p Pact.configuration.tmp_dir
|
|
37
|
-
::File.open(Pact.configuration.tmp_dir + "/#{name}", "w") { |file| file << pact}
|
|
36
|
+
::FileUtils.mkdir_p Pact::Support.configuration.tmp_dir
|
|
37
|
+
::File.open(Pact::Support.configuration.tmp_dir + "/#{name}", "w") { |file| file << pact}
|
|
38
38
|
rescue Errno::EROFS
|
|
39
39
|
# do nothing, probably on RunKit
|
|
40
40
|
end
|
|
@@ -108,7 +108,7 @@ module Pact
|
|
|
108
108
|
http.use_ssl = (uri.scheme == 'https')
|
|
109
109
|
http.ca_file = ENV['SSL_CERT_FILE'] if ENV['SSL_CERT_FILE'] && ENV['SSL_CERT_FILE'] != ''
|
|
110
110
|
http.ca_path = ENV['SSL_CERT_DIR'] if ENV['SSL_CERT_DIR'] && ENV['SSL_CERT_DIR'] != ''
|
|
111
|
-
http.set_debug_output(Pact::Http::AuthorizationHeaderRedactor.new(Pact.configuration.output_stream)) if verbose?(options)
|
|
111
|
+
http.set_debug_output(Pact::Http::AuthorizationHeaderRedactor.new(Pact::Support.configuration.output_stream)) if verbose?(options)
|
|
112
112
|
|
|
113
113
|
if x509_certificate?
|
|
114
114
|
http.cert = OpenSSL::X509::Certificate.new(x509_client_cert_file)
|
|
@@ -117,7 +117,7 @@ module Pact
|
|
|
117
117
|
|
|
118
118
|
if disable_ssl_verification?
|
|
119
119
|
if verbose?(options)
|
|
120
|
-
Pact.configuration.output_stream.puts("SSL verification is disabled")
|
|
120
|
+
Pact::Support.configuration.output_stream.puts("SSL verification is disabled")
|
|
121
121
|
end
|
|
122
122
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
|
123
123
|
end
|
|
@@ -43,7 +43,7 @@ module Pact
|
|
|
43
43
|
# other will always be a QueryString, not a QueryHash, as it will have ben created
|
|
44
44
|
# from the actual query string.
|
|
45
45
|
def difference(other)
|
|
46
|
-
require 'pact/matchers' # avoid recursive loop between this file, pact/reification and pact/matchers
|
|
46
|
+
require 'pact/support/matchers' # avoid recursive loop between this file, pact/reification and pact/matchers
|
|
47
47
|
|
|
48
48
|
if any_key_contains_square_brackets?
|
|
49
49
|
other_query_hash_non_nested = Query.parse_string_as_non_nested_query(other.query)
|
|
@@ -26,7 +26,7 @@ module Pact
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def difference(other)
|
|
29
|
-
require 'pact/matchers' # avoid recursive loop between this file and pact/matchers
|
|
29
|
+
require 'pact/support/matchers' # avoid recursive loop between this file and pact/matchers
|
|
30
30
|
Pact::Matchers.diff(query, other.query)
|
|
31
31
|
end
|
|
32
32
|
|
|
@@ -31,14 +31,14 @@ module Pact
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def matches_route? actual_request
|
|
34
|
-
require 'pact/matchers' # avoid recusive loop between pact/reification, pact/matchers and this file
|
|
34
|
+
require 'pact/support/matchers' # avoid recusive loop between pact/reification, pact/matchers and this file
|
|
35
35
|
route = {:method => method.upcase, :path => path}
|
|
36
36
|
other_route = {:method => actual_request.method.upcase, :path => actual_request.path}
|
|
37
37
|
Pact::Matchers.diff(route, other_route).empty?
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def difference(actual_request)
|
|
41
|
-
require 'pact/matchers' # avoid recusive loop between pact/reification, pact/matchers and this file
|
|
41
|
+
require 'pact/support/matchers' # avoid recusive loop between pact/reification, pact/matchers and this file
|
|
42
42
|
request_diff = Pact::Matchers.diff(to_hash_without_body_or_query, actual_request.to_hash_without_body_or_query)
|
|
43
43
|
request_diff.merge!(query_diff(actual_request.query))
|
|
44
44
|
request_diff.merge!(body_diff(actual_request.body))
|
|
@@ -78,7 +78,7 @@ module Pact
|
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
def body_differ
|
|
81
|
-
Pact.configuration.body_differ_for_content_type content_type
|
|
81
|
+
Pact::Support.configuration.body_differ_for_content_type content_type
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
end
|
data/lib/pact/logging.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require 'logger'
|
|
2
|
-
require 'pact/configuration'
|
|
2
|
+
require 'pact/support/configuration'
|
|
3
3
|
|
|
4
4
|
module Pact
|
|
5
5
|
module Logging
|
|
@@ -8,7 +8,7 @@ module Pact
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def logger
|
|
11
|
-
Pact.configuration.logger
|
|
11
|
+
Pact::Support.configuration.logger
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
end
|
|
@@ -18,7 +18,7 @@ module Pact
|
|
|
18
18
|
@colour = options.fetch(:colour, false)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
def self.call diff, options = {colour: Pact.configuration.color_enabled}
|
|
21
|
+
def self.call diff, options = {colour: Pact::Support.configuration.color_enabled}
|
|
22
22
|
new(diff, options).call
|
|
23
23
|
end
|
|
24
24
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require 'pact/configuration'
|
|
1
|
+
require 'pact/support/configuration'
|
|
2
2
|
require 'pact/term'
|
|
3
3
|
require 'pact/something_like'
|
|
4
4
|
require 'pact/array_like'
|
|
@@ -42,7 +42,7 @@ module Pact
|
|
|
42
42
|
private
|
|
43
43
|
|
|
44
44
|
def configurable_options
|
|
45
|
-
{ treat_all_number_classes_as_equivalent: Pact.configuration.treat_all_number_classes_as_equivalent }
|
|
45
|
+
{ treat_all_number_classes_as_equivalent: Pact::Support.configuration.treat_all_number_classes_as_equivalent }
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
def calculate_diff expected, actual, opts = {}
|
|
@@ -21,9 +21,9 @@ module Pact
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def self.call diff, options = {}
|
|
24
|
-
# require stops circular dependency from pact/configuration <-> pact/matchers/unix_diff_formatter
|
|
25
|
-
require 'pact/configuration'
|
|
26
|
-
default_options = {colour: Pact.configuration.color_enabled}
|
|
24
|
+
# require stops circular dependency from pact/support/configuration <-> pact/matchers/unix_diff_formatter
|
|
25
|
+
require 'pact/support/configuration'
|
|
26
|
+
default_options = {colour: Pact::Support.configuration.color_enabled}
|
|
27
27
|
new(diff, default_options.merge(options)).call
|
|
28
28
|
end
|
|
29
29
|
|
|
@@ -74,7 +74,7 @@ module Pact
|
|
|
74
74
|
|
|
75
75
|
def warn_when_not_one_example_item array, path
|
|
76
76
|
unless array.size == 1
|
|
77
|
-
Pact.configuration.error_stream.puts "WARN: Only the first item will be used to match the items in the array at #{path}"
|
|
77
|
+
Pact::Support.configuration.error_stream.puts "WARN: Only the first item will be used to match the items in the array at #{path}"
|
|
78
78
|
end
|
|
79
79
|
end
|
|
80
80
|
|
|
@@ -76,7 +76,7 @@ module Pact
|
|
|
76
76
|
|
|
77
77
|
def warn_when_not_one_example_item array, path
|
|
78
78
|
unless array.size == 1
|
|
79
|
-
Pact.configuration.error_stream.puts "WARN: Only the first item will be used to match the items in the array at #{path}"
|
|
79
|
+
Pact::Support.configuration.error_stream.puts "WARN: Only the first item will be used to match the items in the array at #{path}"
|
|
80
80
|
end
|
|
81
81
|
end
|
|
82
82
|
|
|
@@ -42,7 +42,7 @@ module Pact
|
|
|
42
42
|
# Oh ActiveSupport, why....
|
|
43
43
|
def fix_json_formatting json
|
|
44
44
|
if json =~ /\{".*?":"/
|
|
45
|
-
json = JSON.pretty_generate(JSON.parse(json
|
|
45
|
+
json = JSON.pretty_generate(JSON.parse(json))
|
|
46
46
|
else
|
|
47
47
|
json
|
|
48
48
|
end
|
|
@@ -57,8 +57,8 @@ module Pact
|
|
|
57
57
|
thing.instance_variables.each do | iv_name |
|
|
58
58
|
iv = thing.instance_variable_get(iv_name)
|
|
59
59
|
if iv.is_a?(Regexp)
|
|
60
|
-
require 'pact/configuration'
|
|
61
|
-
Pact.configuration.error_stream.puts("WARN: Instance variable #{iv_name} for class #{thing.class.name} is a Regexp and isn't been serialized properly. Please raise an issue at https://github.com/pact-foundation/pact-support/issues/new.")
|
|
60
|
+
require 'pact/support/configuration'
|
|
61
|
+
Pact::Support.configuration.error_stream.puts("WARN: Instance variable #{iv_name} for class #{thing.class.name} is a Regexp and isn't been serialized properly. Please raise an issue at https://github.com/pact-foundation/pact-support/issues/new.")
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
64
|
end
|
|
@@ -4,7 +4,7 @@ module Pact
|
|
|
4
4
|
class FormDiffer
|
|
5
5
|
|
|
6
6
|
def self.call expected, actual, options = {}
|
|
7
|
-
require 'pact/matchers' # avoid recursive loop between this file and pact/matchers
|
|
7
|
+
require 'pact/support/matchers' # avoid recursive loop between this file and pact/matchers
|
|
8
8
|
::Pact::Matchers.diff to_hash(expected), to_hash(actual), options
|
|
9
9
|
end
|
|
10
10
|
|
|
@@ -3,7 +3,7 @@ module Pact
|
|
|
3
3
|
|
|
4
4
|
# Delegates to https://github.com/pact-foundation/pact-support/blob/master/lib/pact/matchers/matchers.rb#L25
|
|
5
5
|
def self.call expected, actual, options = {}
|
|
6
|
-
require 'pact/matchers' # avoid recursive loop between this file and pact/matchers
|
|
6
|
+
require 'pact/support/matchers' # avoid recursive loop between this file and pact/matchers
|
|
7
7
|
::Pact::Matchers.diff expected, actual, options
|
|
8
8
|
end
|
|
9
9
|
end
|
|
@@ -4,7 +4,7 @@ require 'pact/shared/text_differ'
|
|
|
4
4
|
module Pact
|
|
5
5
|
class MultipartFormDiffer
|
|
6
6
|
def self.call expected, actual, options = {}
|
|
7
|
-
require 'pact/matchers' # avoid recursive loop between this file and pact/matchers
|
|
7
|
+
require 'pact/support/matchers' # avoid recursive loop between this file and pact/matchers
|
|
8
8
|
expected_boundary = expected.split.first
|
|
9
9
|
actual_boundary = actual.split.first
|
|
10
10
|
actual_with_hardcoded_boundary = actual.gsub(actual_boundary, expected_boundary)
|
|
@@ -3,7 +3,7 @@ module Pact
|
|
|
3
3
|
class TextDiffer
|
|
4
4
|
|
|
5
5
|
def self.call expected, actual, options = {}
|
|
6
|
-
require 'pact/matchers' # avoid recursive loop between this file and pact/matchers
|
|
6
|
+
require 'pact/support/matchers' # avoid recursive loop between this file and pact/matchers
|
|
7
7
|
::Pact::Matchers.diff expected, actual, options
|
|
8
8
|
end
|
|
9
9
|
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
require 'pact/matchers/embedded_diff_formatter'
|
|
2
|
+
require 'pact/matchers/unix_diff_formatter'
|
|
3
|
+
require 'pact/matchers/list_diff_formatter'
|
|
4
|
+
require 'pact/matchers/multipart_form_diff_formatter'
|
|
5
|
+
require 'pact/shared/json_differ'
|
|
6
|
+
require 'pact/shared/text_differ'
|
|
7
|
+
require 'pact/shared/form_differ'
|
|
8
|
+
require 'pact/shared/multipart_form_differ'
|
|
9
|
+
require 'rainbow'
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
module Pact
|
|
13
|
+
module Support
|
|
14
|
+
|
|
15
|
+
class Configuration
|
|
16
|
+
|
|
17
|
+
DIFF_FORMATTERS = {
|
|
18
|
+
:embedded => Pact::Matchers::EmbeddedDiffFormatter,
|
|
19
|
+
:unix => Pact::Matchers::UnixDiffFormatter,
|
|
20
|
+
:list => Pact::Matchers::ListDiffFormatter
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class NilMatcher
|
|
25
|
+
def self.=~ other
|
|
26
|
+
other == nil ? 0 : nil
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
DIFF_FORMATTER_REGISTRATIONS = [
|
|
31
|
+
[/multipart\/form-data/, Pact::Matchers::MultipartFormDiffFormatter],
|
|
32
|
+
[/.*/, Pact::Matchers::UnixDiffFormatter],
|
|
33
|
+
[NilMatcher, Pact::Matchers::UnixDiffFormatter]
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
DIFFERS = [
|
|
37
|
+
[/json/, Pact::JsonDiffer],
|
|
38
|
+
[/application\/x\-www\-form\-urlencoded/, Pact::FormDiffer],
|
|
39
|
+
[/multipart\/form-data/, Pact::MultipartFormDiffer],
|
|
40
|
+
[NilMatcher, Pact::TextDiffer],
|
|
41
|
+
[/.*/, Pact::TextDiffer]
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
DEFAULT_DIFFER = Pact::TextDiffer
|
|
46
|
+
|
|
47
|
+
attr_accessor :pact_dir
|
|
48
|
+
attr_accessor :log_dir
|
|
49
|
+
attr_accessor :tmp_dir
|
|
50
|
+
|
|
51
|
+
attr_writer :logger
|
|
52
|
+
|
|
53
|
+
attr_accessor :error_stream
|
|
54
|
+
attr_accessor :output_stream
|
|
55
|
+
attr_accessor :pactfile_write_order
|
|
56
|
+
attr_accessor :treat_all_number_classes_as_equivalent # when using type based matching
|
|
57
|
+
|
|
58
|
+
def self.default_configuration
|
|
59
|
+
c = Configuration.new
|
|
60
|
+
c.pact_dir = File.expand_path('./spec/pacts')
|
|
61
|
+
c.tmp_dir = File.expand_path('./tmp/pacts')
|
|
62
|
+
c.log_dir = default_log_dir
|
|
63
|
+
|
|
64
|
+
c.output_stream = $stdout
|
|
65
|
+
c.error_stream = $stderr
|
|
66
|
+
c.pactfile_write_order = :chronological
|
|
67
|
+
c.treat_all_number_classes_as_equivalent = true
|
|
68
|
+
|
|
69
|
+
c
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def initialize
|
|
73
|
+
@differ_registrations = []
|
|
74
|
+
@diff_formatter_registrations = []
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def logger
|
|
78
|
+
@logger ||= create_logger
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Should this be deprecated in favour of register_diff_formatter???
|
|
82
|
+
def diff_formatter= diff_formatter
|
|
83
|
+
register_diff_formatter(/.*/, diff_formatter)
|
|
84
|
+
register_diff_formatter(nil, diff_formatter)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def register_diff_formatter content_type, diff_formatter
|
|
88
|
+
key = content_type_regexp_for content_type
|
|
89
|
+
@diff_formatter_registrations << [key, diff_formatter_for(diff_formatter)]
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def diff_formatter_for_content_type content_type
|
|
93
|
+
diff_formatter_registrations.find{ | registration | registration.first =~ content_type }.last
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def register_body_differ content_type, differ
|
|
97
|
+
key = content_type_regexp_for content_type
|
|
98
|
+
validate_differ differ
|
|
99
|
+
@differ_registrations << [key, differ]
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def body_differ_for_content_type content_type
|
|
103
|
+
differ_registrations
|
|
104
|
+
.find{ | registration | registration.first =~ content_type }
|
|
105
|
+
.tap do |it|
|
|
106
|
+
if content_type.nil? && it.last == Pact::TextDiffer
|
|
107
|
+
error_stream.puts "WARN: No content type found, performing text diff on body"
|
|
108
|
+
logger.warn "No content type found, performing text diff on body"
|
|
109
|
+
end
|
|
110
|
+
end.last
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def log_path
|
|
114
|
+
log_dir + "/pact.log"
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def color_enabled
|
|
118
|
+
# Can't use ||= when the variable might be false, it will execute the expression if it's false
|
|
119
|
+
color_enabled = defined?(@color_enabled) ? @color_enabled : true
|
|
120
|
+
Rainbow.enabled = true if color_enabled
|
|
121
|
+
color_enabled
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def color_enabled= color_enabled
|
|
125
|
+
@color_enabled = color_enabled
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
private
|
|
129
|
+
|
|
130
|
+
def diff_formatter_for input
|
|
131
|
+
if DIFF_FORMATTERS[input]
|
|
132
|
+
DIFF_FORMATTERS[input]
|
|
133
|
+
elsif input.respond_to?(:call)
|
|
134
|
+
input
|
|
135
|
+
else
|
|
136
|
+
raise "Pact diff_formatter needs to respond to call, or be in the preconfigured list: #{DIFF_FORMATTERS.keys}"
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def validate_differ differ
|
|
141
|
+
if !differ.respond_to?(:call)
|
|
142
|
+
raise "Pact::Support.configuration.register_body_differ expects a differ that is a lamda or a class/object that responds to call."
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def content_type_regexp_for content_type
|
|
147
|
+
case content_type
|
|
148
|
+
when String then Regexp.new(/^#{Regexp.escape(content_type)}$/)
|
|
149
|
+
when Regexp then content_type
|
|
150
|
+
when nil then NilMatcher
|
|
151
|
+
else
|
|
152
|
+
raise "Invalid content type used to register a differ (#{content_type.inspect}). Please use a Regexp or a String."
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def differ_registrations
|
|
157
|
+
@differ_registrations + DIFFERS
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def diff_formatter_registrations
|
|
161
|
+
@diff_formatter_registrations + DIFF_FORMATTER_REGISTRATIONS
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def self.default_log_dir
|
|
165
|
+
File.expand_path("./log")
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
#Would love a better way of determining this! It sure won't work on windows.
|
|
169
|
+
def is_rake_running?
|
|
170
|
+
`ps -ef | grep rake | grep #{Process.ppid} | grep -v 'grep'`.size > 0
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def create_logger
|
|
174
|
+
FileUtils::mkdir_p log_dir
|
|
175
|
+
logger = ::Logger.new(log_path)
|
|
176
|
+
logger.level = ::Logger::DEBUG
|
|
177
|
+
logger
|
|
178
|
+
rescue Errno::EROFS
|
|
179
|
+
# So we can run on RunKit
|
|
180
|
+
logger = ::Logger.new($stdout)
|
|
181
|
+
logger.level = ::Logger::DEBUG
|
|
182
|
+
logger
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def self.configuration
|
|
187
|
+
@configuration ||= Configuration.default_configuration
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
def self.configure
|
|
191
|
+
yield configuration
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
def self.clear_configuration
|
|
195
|
+
@configuration = nil
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
end
|
|
@@ -13,6 +13,7 @@ require 'jsonpath'
|
|
|
13
13
|
require 'pact/matching_rules/v3/extract'
|
|
14
14
|
|
|
15
15
|
module Pact
|
|
16
|
+
module Support
|
|
16
17
|
class Generators
|
|
17
18
|
def self.add_generator(generator)
|
|
18
19
|
generators.unshift(generator)
|
|
@@ -60,4 +61,5 @@ module Pact
|
|
|
60
61
|
add_generator(Generator::Time.new)
|
|
61
62
|
add_generator(Generator::Uuid.new)
|
|
62
63
|
end
|
|
64
|
+
end
|
|
63
65
|
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# This is horrible, must work out a better way of doing this
|
|
2
|
+
module Pact
|
|
3
|
+
module Support
|
|
4
|
+
module RSpec
|
|
5
|
+
|
|
6
|
+
def self.color_enabled?
|
|
7
|
+
if ::RSpec.configuration.respond_to?(:color_enabled?)
|
|
8
|
+
::RSpec.configuration.color_enabled?(::RSpec.configuration.output_stream)
|
|
9
|
+
else
|
|
10
|
+
::RSpec.configuration.color_enabled?
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.formatter_class
|
|
15
|
+
if ::RSpec::Core::Formatters.respond_to?(:register)
|
|
16
|
+
require 'pact/provider/rspec/formatter_rspec_3'
|
|
17
|
+
Pact::Provider::RSpec::Formatter
|
|
18
|
+
else
|
|
19
|
+
require 'pact/provider/rspec/formatter_rspec_2'
|
|
20
|
+
Pact::Provider::RSpec::Formatter2
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.full_description example
|
|
25
|
+
example.respond_to?(:full_description) ? example.full_description : example.example.full_description
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def self.runner_defined?
|
|
29
|
+
defined?(::RSpec::Core::Runner)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def self.is_rspec_3
|
|
33
|
+
defined?(::RSpec) && ::RSpec::Core::Formatters.respond_to?(:register)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def self.is_rspec_2
|
|
37
|
+
defined?(::RSpec) && !is_rspec_3
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def self.with_rspec_3
|
|
41
|
+
if is_rspec_3
|
|
42
|
+
yield
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.with_rspec_2
|
|
47
|
+
if is_rspec_2
|
|
48
|
+
yield
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
end
|
data/lib/pact/support/version.rb
CHANGED
data/lib/pact/support.rb
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
require 'pact/support/version'
|
|
2
2
|
require 'pact/consumer_contract'
|
|
3
|
-
require 'pact/matchers'
|
|
3
|
+
require 'pact/support/matchers'
|
|
4
4
|
require 'pact/logging'
|
|
5
5
|
require 'pact/term'
|
|
6
6
|
require 'pact/helpers'
|
|
7
|
-
require 'pact/configuration'
|
|
7
|
+
require 'pact/support/configuration'
|
|
8
8
|
require 'pact/reification'
|
|
9
9
|
|
|
10
10
|
module Pact
|
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:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Fraser
|
|
@@ -83,6 +83,26 @@ dependencies:
|
|
|
83
83
|
- - "~>"
|
|
84
84
|
- !ruby/object:Gem::Version
|
|
85
85
|
version: '2.0'
|
|
86
|
+
- !ruby/object:Gem::Dependency
|
|
87
|
+
name: json
|
|
88
|
+
requirement: !ruby/object:Gem::Requirement
|
|
89
|
+
requirements:
|
|
90
|
+
- - ">="
|
|
91
|
+
- !ruby/object:Gem::Version
|
|
92
|
+
version: 2.19.9
|
|
93
|
+
- - "<"
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '3.0'
|
|
96
|
+
type: :runtime
|
|
97
|
+
prerelease: false
|
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - ">="
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: 2.19.9
|
|
103
|
+
- - "<"
|
|
104
|
+
- !ruby/object:Gem::Version
|
|
105
|
+
version: '3.0'
|
|
86
106
|
- !ruby/object:Gem::Dependency
|
|
87
107
|
name: jsonpath
|
|
88
108
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -327,7 +347,6 @@ files:
|
|
|
327
347
|
- LICENSE.txt
|
|
328
348
|
- README.md
|
|
329
349
|
- lib/pact/array_like.rb
|
|
330
|
-
- lib/pact/configuration.rb
|
|
331
350
|
- lib/pact/consumer/request.rb
|
|
332
351
|
- lib/pact/consumer_contract.rb
|
|
333
352
|
- lib/pact/consumer_contract/consumer_contract.rb
|
|
@@ -360,11 +379,9 @@ files:
|
|
|
360
379
|
- lib/pact/generator/regex.rb
|
|
361
380
|
- lib/pact/generator/time.rb
|
|
362
381
|
- lib/pact/generator/uuid.rb
|
|
363
|
-
- lib/pact/generators.rb
|
|
364
382
|
- lib/pact/helpers.rb
|
|
365
383
|
- lib/pact/http/authorization_header_redactor.rb
|
|
366
384
|
- lib/pact/logging.rb
|
|
367
|
-
- lib/pact/matchers.rb
|
|
368
385
|
- lib/pact/matchers/actual_type.rb
|
|
369
386
|
- lib/pact/matchers/base_difference.rb
|
|
370
387
|
- lib/pact/matchers/differ.rb
|
|
@@ -390,7 +407,6 @@ files:
|
|
|
390
407
|
- lib/pact/matching_rules/v3/extract.rb
|
|
391
408
|
- lib/pact/matching_rules/v3/merge.rb
|
|
392
409
|
- lib/pact/reification.rb
|
|
393
|
-
- lib/pact/rspec.rb
|
|
394
410
|
- lib/pact/shared/active_support_support.rb
|
|
395
411
|
- lib/pact/shared/dsl.rb
|
|
396
412
|
- lib/pact/shared/form_differ.rb
|
|
@@ -404,6 +420,10 @@ files:
|
|
|
404
420
|
- lib/pact/something_like.rb
|
|
405
421
|
- lib/pact/specification_version.rb
|
|
406
422
|
- lib/pact/support.rb
|
|
423
|
+
- lib/pact/support/configuration.rb
|
|
424
|
+
- lib/pact/support/generators.rb
|
|
425
|
+
- lib/pact/support/matchers.rb
|
|
426
|
+
- lib/pact/support/rspec.rb
|
|
407
427
|
- lib/pact/support/version.rb
|
|
408
428
|
- lib/pact/symbolize_keys.rb
|
|
409
429
|
- lib/pact/term.rb
|
|
@@ -426,7 +446,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
426
446
|
- !ruby/object:Gem::Version
|
|
427
447
|
version: '0'
|
|
428
448
|
requirements: []
|
|
429
|
-
rubygems_version: 4.0.
|
|
449
|
+
rubygems_version: 4.0.20
|
|
430
450
|
specification_version: 4
|
|
431
451
|
summary: Shared code for Pact gems
|
|
432
452
|
test_files: []
|
data/lib/pact/configuration.rb
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
require 'pact/matchers/embedded_diff_formatter'
|
|
2
|
-
require 'pact/matchers/unix_diff_formatter'
|
|
3
|
-
require 'pact/matchers/list_diff_formatter'
|
|
4
|
-
require 'pact/matchers/multipart_form_diff_formatter'
|
|
5
|
-
require 'pact/shared/json_differ'
|
|
6
|
-
require 'pact/shared/text_differ'
|
|
7
|
-
require 'pact/shared/form_differ'
|
|
8
|
-
require 'pact/shared/multipart_form_differ'
|
|
9
|
-
require 'rainbow'
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
module Pact
|
|
13
|
-
|
|
14
|
-
class Configuration
|
|
15
|
-
|
|
16
|
-
DIFF_FORMATTERS = {
|
|
17
|
-
:embedded => Pact::Matchers::EmbeddedDiffFormatter,
|
|
18
|
-
:unix => Pact::Matchers::UnixDiffFormatter,
|
|
19
|
-
:list => Pact::Matchers::ListDiffFormatter
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class NilMatcher
|
|
24
|
-
def self.=~ other
|
|
25
|
-
other == nil ? 0 : nil
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
DIFF_FORMATTER_REGISTRATIONS = [
|
|
30
|
-
[/multipart\/form-data/, Pact::Matchers::MultipartFormDiffFormatter],
|
|
31
|
-
[/.*/, Pact::Matchers::UnixDiffFormatter],
|
|
32
|
-
[NilMatcher, Pact::Matchers::UnixDiffFormatter]
|
|
33
|
-
]
|
|
34
|
-
|
|
35
|
-
DIFFERS = [
|
|
36
|
-
[/json/, Pact::JsonDiffer],
|
|
37
|
-
[/application\/x\-www\-form\-urlencoded/, Pact::FormDiffer],
|
|
38
|
-
[/multipart\/form-data/, Pact::MultipartFormDiffer],
|
|
39
|
-
[NilMatcher, Pact::TextDiffer],
|
|
40
|
-
[/.*/, Pact::TextDiffer]
|
|
41
|
-
]
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
DEFAULT_DIFFER = Pact::TextDiffer
|
|
45
|
-
|
|
46
|
-
attr_accessor :pact_dir
|
|
47
|
-
attr_accessor :log_dir
|
|
48
|
-
attr_accessor :tmp_dir
|
|
49
|
-
|
|
50
|
-
attr_writer :logger
|
|
51
|
-
|
|
52
|
-
attr_accessor :error_stream
|
|
53
|
-
attr_accessor :output_stream
|
|
54
|
-
attr_accessor :pactfile_write_order
|
|
55
|
-
attr_accessor :treat_all_number_classes_as_equivalent # when using type based matching
|
|
56
|
-
|
|
57
|
-
def self.default_configuration
|
|
58
|
-
c = Configuration.new
|
|
59
|
-
c.pact_dir = File.expand_path('./spec/pacts')
|
|
60
|
-
c.tmp_dir = File.expand_path('./tmp/pacts')
|
|
61
|
-
c.log_dir = default_log_dir
|
|
62
|
-
|
|
63
|
-
c.output_stream = $stdout
|
|
64
|
-
c.error_stream = $stderr
|
|
65
|
-
c.pactfile_write_order = :chronological
|
|
66
|
-
c.treat_all_number_classes_as_equivalent = true
|
|
67
|
-
|
|
68
|
-
c
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def initialize
|
|
72
|
-
@differ_registrations = []
|
|
73
|
-
@diff_formatter_registrations = []
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def logger
|
|
77
|
-
@logger ||= create_logger
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
# Should this be deprecated in favour of register_diff_formatter???
|
|
81
|
-
def diff_formatter= diff_formatter
|
|
82
|
-
register_diff_formatter(/.*/, diff_formatter)
|
|
83
|
-
register_diff_formatter(nil, diff_formatter)
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
def register_diff_formatter content_type, diff_formatter
|
|
87
|
-
key = content_type_regexp_for content_type
|
|
88
|
-
@diff_formatter_registrations << [key, diff_formatter_for(diff_formatter)]
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
def diff_formatter_for_content_type content_type
|
|
92
|
-
diff_formatter_registrations.find{ | registration | registration.first =~ content_type }.last
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
def register_body_differ content_type, differ
|
|
96
|
-
key = content_type_regexp_for content_type
|
|
97
|
-
validate_differ differ
|
|
98
|
-
@differ_registrations << [key, differ]
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
def body_differ_for_content_type content_type
|
|
102
|
-
differ_registrations
|
|
103
|
-
.find{ | registration | registration.first =~ content_type }
|
|
104
|
-
.tap do |it|
|
|
105
|
-
if content_type.nil? && it.last == Pact::TextDiffer
|
|
106
|
-
error_stream.puts "WARN: No content type found, performing text diff on body"
|
|
107
|
-
logger.warn "No content type found, performing text diff on body"
|
|
108
|
-
end
|
|
109
|
-
end.last
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
def log_path
|
|
113
|
-
log_dir + "/pact.log"
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
def color_enabled
|
|
117
|
-
# Can't use ||= when the variable might be false, it will execute the expression if it's false
|
|
118
|
-
color_enabled = defined?(@color_enabled) ? @color_enabled : true
|
|
119
|
-
Rainbow.enabled = true if color_enabled
|
|
120
|
-
color_enabled
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
def color_enabled= color_enabled
|
|
124
|
-
@color_enabled = color_enabled
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
private
|
|
128
|
-
|
|
129
|
-
def diff_formatter_for input
|
|
130
|
-
if DIFF_FORMATTERS[input]
|
|
131
|
-
DIFF_FORMATTERS[input]
|
|
132
|
-
elsif input.respond_to?(:call)
|
|
133
|
-
input
|
|
134
|
-
else
|
|
135
|
-
raise "Pact diff_formatter needs to respond to call, or be in the preconfigured list: #{DIFF_FORMATTERS.keys}"
|
|
136
|
-
end
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
def validate_differ differ
|
|
140
|
-
if !differ.respond_to?(:call)
|
|
141
|
-
raise "Pact.configuration.register_body_differ expects a differ that is a lamda or a class/object that responds to call."
|
|
142
|
-
end
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
def content_type_regexp_for content_type
|
|
146
|
-
case content_type
|
|
147
|
-
when String then Regexp.new(/^#{Regexp.escape(content_type)}$/)
|
|
148
|
-
when Regexp then content_type
|
|
149
|
-
when nil then NilMatcher
|
|
150
|
-
else
|
|
151
|
-
raise "Invalid content type used to register a differ (#{content_type.inspect}). Please use a Regexp or a String."
|
|
152
|
-
end
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
def differ_registrations
|
|
156
|
-
@differ_registrations + DIFFERS
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
def diff_formatter_registrations
|
|
160
|
-
@diff_formatter_registrations + DIFF_FORMATTER_REGISTRATIONS
|
|
161
|
-
end
|
|
162
|
-
|
|
163
|
-
def self.default_log_dir
|
|
164
|
-
File.expand_path("./log")
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
#Would love a better way of determining this! It sure won't work on windows.
|
|
168
|
-
def is_rake_running?
|
|
169
|
-
`ps -ef | grep rake | grep #{Process.ppid} | grep -v 'grep'`.size > 0
|
|
170
|
-
end
|
|
171
|
-
|
|
172
|
-
def create_logger
|
|
173
|
-
FileUtils::mkdir_p log_dir
|
|
174
|
-
logger = ::Logger.new(log_path)
|
|
175
|
-
logger.level = ::Logger::DEBUG
|
|
176
|
-
logger
|
|
177
|
-
rescue Errno::EROFS
|
|
178
|
-
# So we can run on RunKit
|
|
179
|
-
logger = ::Logger.new($stdout)
|
|
180
|
-
logger.level = ::Logger::DEBUG
|
|
181
|
-
logger
|
|
182
|
-
end
|
|
183
|
-
end
|
|
184
|
-
|
|
185
|
-
def self.configuration
|
|
186
|
-
@configuration ||= Configuration.default_configuration
|
|
187
|
-
end
|
|
188
|
-
|
|
189
|
-
def self.configure
|
|
190
|
-
yield configuration
|
|
191
|
-
end
|
|
192
|
-
|
|
193
|
-
def self.clear_configuration
|
|
194
|
-
@configuration = nil
|
|
195
|
-
end
|
|
196
|
-
end
|
data/lib/pact/rspec.rb
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# This is horrible, must work out a better way of doing this
|
|
2
|
-
module Pact
|
|
3
|
-
module RSpec
|
|
4
|
-
|
|
5
|
-
def self.color_enabled?
|
|
6
|
-
if ::RSpec.configuration.respond_to?(:color_enabled?)
|
|
7
|
-
::RSpec.configuration.color_enabled?(::RSpec.configuration.output_stream)
|
|
8
|
-
else
|
|
9
|
-
::RSpec.configuration.color_enabled?
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def self.formatter_class
|
|
14
|
-
if ::RSpec::Core::Formatters.respond_to?(:register)
|
|
15
|
-
require 'pact/provider/rspec/formatter_rspec_3'
|
|
16
|
-
Pact::Provider::RSpec::Formatter
|
|
17
|
-
else
|
|
18
|
-
require 'pact/provider/rspec/formatter_rspec_2'
|
|
19
|
-
Pact::Provider::RSpec::Formatter2
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def self.full_description example
|
|
24
|
-
example.respond_to?(:full_description) ? example.full_description : example.example.full_description
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def self.runner_defined?
|
|
28
|
-
defined?(::RSpec::Core::Runner)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def self.is_rspec_3
|
|
32
|
-
defined?(::RSpec) && ::RSpec::Core::Formatters.respond_to?(:register)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def self.is_rspec_2
|
|
36
|
-
defined?(::RSpec) && !is_rspec_3
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def self.with_rspec_3
|
|
40
|
-
if is_rspec_3
|
|
41
|
-
yield
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def self.with_rspec_2
|
|
46
|
-
if is_rspec_2
|
|
47
|
-
yield
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
File without changes
|