Skip to content

Commit

Permalink
Simplify github_domain? check + add test
Browse files Browse the repository at this point in the history
  • Loading branch information
yoannchaudet committed Sep 10, 2024
1 parent 4785cd4 commit c7a2b83
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/github-pages-health-check/domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def pages_dot_github_dot_com?

# Is this domain owned by GitHub?
def github_domain?
!!host.match(/(\A|\.)github\.com\.?\z/i)
host.downcase.eql?("github.com") || host.downcase.end_with?(".github.com")
end

# Is the host our Fastly CNAME?
Expand Down
8 changes: 8 additions & 0 deletions spec/github_pages_health_check/domain_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,14 @@
end
end

context "not github domains" do
let(:domain) { "somethinggithub.com" }

it "knows if the domain is a github domain" do
expect(subject).to_not be_a_github_domain
end
end

context "fastly domain" do
let(:domain) { "github.map.fastly.net" }

Expand Down

0 comments on commit c7a2b83

Please sign in to comment.