mirror of
https://github.com/discourse/discourse.git
synced 2025-03-09 14:34:35 +00:00
FIX: Broken specs
This commit is contained in:
parent
75b03dab84
commit
7058205f70
@ -304,7 +304,7 @@ class FinalDestination
|
|||||||
|
|
||||||
def self.lookup_ip(host)
|
def self.lookup_ip(host)
|
||||||
if Rails.env.test?
|
if Rails.env.test?
|
||||||
"0.0.0.0"
|
"1.1.1.1"
|
||||||
else
|
else
|
||||||
IPSocket::getaddress(host)
|
IPSocket::getaddress(host)
|
||||||
end
|
end
|
||||||
|
@ -338,8 +338,17 @@ describe FinalDestination do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "returns false for short ip" do
|
it "returns false for short ip" do
|
||||||
expect(FinalDestination.new('https://0/logo.png').is_dest_valid?).to eq(false)
|
lookup = lambda do |host|
|
||||||
expect(FinalDestination.new('https://1/logo.png').is_dest_valid?).to eq(false)
|
# How IPs are looked up for single digits
|
||||||
|
if host == "0"
|
||||||
|
"0.0.0.0"
|
||||||
|
elsif host == "1"
|
||||||
|
"0.0.0.1"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
expect(FinalDestination.new('https://0/logo.png', lookup_ip: lookup).is_dest_valid?).to eq(false)
|
||||||
|
expect(FinalDestination.new('https://1/logo.png', lookup_ip: lookup).is_dest_valid?).to eq(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns false for private ipv4" do
|
it "returns false for private ipv4" do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user