From 3f7dfc56451da427bed018e204ee7d55a0430892 Mon Sep 17 00:00:00 2001 From: tsusdere Date: Wed, 10 Apr 2024 10:54:46 -0500 Subject: [PATCH] fix linting --- lib/github-pages-health-check/domain.rb | 6 ++++-- spec/github_pages_health_check/domain_spec.rb | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/github-pages-health-check/domain.rb b/lib/github-pages-health-check/domain.rb index 69c130d..924b45a 100644 --- a/lib/github-pages-health-check/domain.rb +++ b/lib/github-pages-health-check/domain.rb @@ -243,11 +243,13 @@ def cname_to_github_user_domain? cname? && !cname_to_pages_dot_github_dot_com? && cname.pages_domain? end - # Check if the CNAME points to a Domain that points to pages - # e.g. CNAME -> Domain -> Pages + # Check if the CNAME points to a Domain that points to pages + # e.g. CNAME -> Domain -> Pages def cname_to_domain_to_pages? a_record_to_pages = dns.select { |d| d.type == Dnsruby::Types::A && d.name.to_s == host }.first + return false unless a_record_to_pages && cname? && !cname_to_pages_dot_github_dot_com? + CURRENT_IP_ADDRESSES.include?(a_record_to_pages.address.to_s.downcase) end diff --git a/spec/github_pages_health_check/domain_spec.rb b/spec/github_pages_health_check/domain_spec.rb index 04cbedd..0308036 100644 --- a/spec/github_pages_health_check/domain_spec.rb +++ b/spec/github_pages_health_check/domain_spec.rb @@ -240,7 +240,7 @@ end end - context "CNAME to Domain to Pages", focus: true do + context "CNAME to Domain to Pages" do let(:cname) { "www.fontawesome.it" } let(:domain) { "fontawesome.it" } let(:ip) { "185.199.108.153" } @@ -248,7 +248,7 @@ allow(subject).to receive(:dns) do [ Dnsruby::RR.create("#{cname}. 1000 IN CNAME #{domain}"), - a_packet, + a_packet ] end end