Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
tsusdere committed Apr 10, 2024
1 parent d02c892 commit 3f7dfc5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lib/github-pages-health-check/domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions spec/github_pages_health_check/domain_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,15 @@
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" }
before do
allow(subject).to receive(:dns) do
[
Dnsruby::RR.create("#{cname}. 1000 IN CNAME #{domain}"),
a_packet,
a_packet
]
end
end
Expand Down

0 comments on commit 3f7dfc5

Please sign in to comment.