Skip to content

Commit 8ef6311

Browse files
authored
Merge pull request pact-foundation#53 from iamvery/ruby-2-5-warnings
Fix Ruby 2.5 warnings
2 parents e74dfaa + 3d2a488 commit 8ef6311

File tree

10 files changed

+11
-18
lines changed

10 files changed

+11
-18
lines changed

lib/pact/configuration.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ def logger
7272

7373
# Should this be deprecated in favour of register_diff_formatter???
7474
def diff_formatter= diff_formatter
75-
register_diff_formatter /.*/, diff_formatter
76-
register_diff_formatter nil, diff_formatter
75+
register_diff_formatter(/.*/, diff_formatter)
76+
register_diff_formatter(nil, diff_formatter)
7777
end
7878

7979
def register_diff_formatter content_type, diff_formatter

lib/pact/consumer_contract/consumer_contract.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def self.from_hash(hash)
3434
new(
3535
:consumer => ServiceConsumer.from_hash(hash[:consumer]),
3636
:provider => ServiceProvider.from_hash(hash[:provider]),
37-
:interactions => hash[:interactions].collect { |hash| Interaction.from_hash(hash)}
37+
:interactions => hash[:interactions].collect { |h| Interaction.from_hash(h)}
3838
)
3939
end
4040

lib/pact/consumer_contract/query_string.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require 'pact/shared/active_support_support'
2-
require 'pact/matchers'
32

43
module Pact
54
class QueryString

lib/pact/matchers/matchers.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def type_difference_message expected, actual
224224
expected_desc = class_name_with_value_in_brackets(expected)
225225
expected_desc.gsub!("(", "(like ")
226226
actual_desc = class_name_with_value_in_brackets(actual)
227-
message = "Expected #{expected_desc} but got #{actual_desc} at <path>"
227+
"Expected #{expected_desc} but got #{actual_desc} at <path>"
228228
end
229229
end
230230
end

lib/pact/matching_rules/jsonpath.rb

+3-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ class JsonPath
1313
def initialize(path)
1414
scanner = StringScanner.new(path)
1515
@path = []
16-
bracket_count = 0
1716
while not scanner.eos?
1817
if token = scanner.scan(/\$/)
1918
@path << token
@@ -49,10 +48,10 @@ def initialize(path)
4948
@path.last << token
5049
end
5150
end
51+
end
5252

53-
def to_s
54-
path.join
55-
end
53+
def to_s
54+
path.join
5655
end
5756
end
5857
end

lib/pact/reification.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ def self.from_term(term)
1515
when Pact::Term, Regexp, Pact::SomethingLike, Pact::ArrayLike
1616
from_term(term.generate)
1717
when Hash
18-
term.inject({}) do |mem, (key,term)|
19-
mem[key] = from_term(term)
18+
term.inject({}) do |mem, (key,t)|
19+
mem[key] = from_term(t)
2020
mem
2121
end
2222
when Array

lib/pact/shared/form_differ.rb

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
require 'pact/matchers/matchers'
21
require 'uri'
32

43
module Pact
@@ -19,8 +18,8 @@ def self.to_hash form_body
1918
end
2019

2120
def self.ensure_values_are_arrays hash
22-
hash.each_with_object({}) do | (key, value), hash |
23-
hash[key.to_s] = [*value]
21+
hash.each_with_object({}) do | (key, value), h |
22+
h[key.to_s] = [*value]
2423
end
2524
end
2625

lib/pact/shared/json_differ.rb

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require 'pact/matchers/matchers'
2-
31
module Pact
42
class JsonDiffer
53

lib/pact/shared/request.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
require 'pact/matchers'
21
require 'pact/symbolize_keys'
32
require 'pact/consumer_contract/headers'
43
require 'pact/consumer_contract/query'

lib/pact/shared/text_differ.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
require 'pact/matchers/matchers'
21
require 'pact/matchers/difference'
32

43
module Pact

0 commit comments

Comments
 (0)