Skip to content

Commit

Permalink
Fix TestPuma::HOST4 (#3254)
Browse files Browse the repository at this point in the history
`Array#sort` takes a block that accept 2 parameters.

The intent here was to use `sort_by`.

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
  • Loading branch information
casperisfine and byroot committed Oct 11, 2023
1 parent 8129aae commit ba4ece4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions test/helpers/test_puma.rb
Expand Up @@ -11,7 +11,7 @@ module TestPuma

HOST4 = begin
t = Socket.ip_address_list.select(&:ipv4_loopback?).map(&:ip_address)
.uniq.sort(&:length)
.uniq.sort_by(&:length)
# puts "IPv4 Loopback #{t}"
str = t.include?('127.0.0.1') ? +'127.0.0.1' : +"#{t.first}"
str.define_singleton_method(:ip) { self }
Expand All @@ -20,9 +20,8 @@ module TestPuma

HOST6 = begin
t = Socket.ip_address_list.select(&:ipv6_loopback?).map(&:ip_address)
.uniq.sort(&:length)
.uniq.sort_by(&:length)
# puts "IPv6 Loopback #{t}"
t.include?('::1') ? +'[::1]' : "[#{t.first}]"
str = t.include?('::1') ? +'[::1]' : +"[#{t.first}]"
str.define_singleton_method(:ip) { self.gsub RE_HOST_TO_IP, '' }
str.freeze
Expand Down

0 comments on commit ba4ece4

Please sign in to comment.