Skip to content

Commit

Permalink
fix: Fixup ruby warnings (#96)
Browse files Browse the repository at this point in the history
```
…/json/add/regexp.rb:17: warning: method redefined; discarding old as_json
…/activesupport-7.0.2.3/lib/active_support/core_ext/object/json.rb:134: warning: previous definition of as_json was here
…/consumer_contract/interaction_v2_parser.rb:41: warning: assigned but unused variable - request
…/matching_rules/merge.rb:45: warning: assigned but unused variable - recursed
…/consumer_contract/pact_file.rb:39: warning: assigned but unused variable - e
…/consumer_contract/pact_file.rb:61: warning: mismatched indentations at 'end' with 'if' at 58
```
  • Loading branch information
ojab authored Mar 28, 2022
1 parent e8b6ada commit cee7113
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/pact/consumer_contract/interaction_v2_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def self.parse_request request_hash, options
if query_is_string
request_hash['query'] = Pact::QueryHash.new(request_hash['query'], original_query_string, Pact::Query.parsed_as_nested?(request_hash['query']))
end
request = Pact::Request::Expected.from_hash(request_hash)
Pact::Request::Expected.from_hash(request_hash)
end

def self.parse_response response_hash, options
Expand Down
8 changes: 4 additions & 4 deletions lib/pact/consumer_contract/pact_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def read uri, options = {}
def save_pactfile_to_tmp pact, name
::FileUtils.mkdir_p Pact.configuration.tmp_dir
::File.open(Pact.configuration.tmp_dir + "/#{name}", "w") { |file| file << pact}
rescue Errno::EROFS => e
rescue Errno::EROFS
# do nothing, probably on RunKit
end

Expand All @@ -56,9 +56,9 @@ def get_local(filepath, _)
def get_remote_with_retry(uri_string, options)
uri = URI(uri_string)
if uri.userinfo
options[:username] = uri.user unless options[:username]
options[:password] = uri.password unless options[:password]
end
options[:username] = uri.user unless options[:username]
options[:password] = uri.password unless options[:password]
end
((options[:retry_limit] || RETRY_LIMIT) + 1).times do |i|
begin
response = get_remote(uri, options)
Expand Down
2 changes: 1 addition & 1 deletion lib/pact/matching_rules/merge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def recurse expected, path
end

def recurse_hash hash, path
recursed = hash.each_with_object({}) do | (k, v), new_hash |
hash.each_with_object({}) do | (k, v), new_hash |
new_path = path + "['#{k}']"
new_hash[k] = recurse(v, new_path)
end
Expand Down
1 change: 1 addition & 0 deletions lib/pact/term.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'pact/shared/active_support_support'
Regexp.remove_method(:as_json) if Regexp.method_defined?(:as_json)
require 'json/add/regexp'
require 'pact/errors'

Expand Down

0 comments on commit cee7113

Please sign in to comment.