Skip to content

Commit

Permalink
add unit tests for repository#source
Browse files Browse the repository at this point in the history
  • Loading branch information
benbalter committed Aug 15, 2017
1 parent 49be1c1 commit 7abdfe2
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 4 deletions.
12 changes: 12 additions & 0 deletions spec/repository_compat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
it "forces HTTPS for the URL" do
expect(repo_compat.pages_url).to eql("https://hubot.github.com")
end

it "returns the source" do
expect(repo_compat.source).to eql({ "branch" => "gh-pages", "path" => "/" })
end
end

context "ben.balter.com" do
Expand All @@ -36,6 +40,10 @@
it "uses Pages.scheme to determine scheme for domain" do
expect(repo_compat.pages_url).to eql("http://ben.balter.com")
end

it "returns the source" do
expect(repo_compat.source).to eql({ "branch" => "master", "path" => "/" })
end
end

context "parkr.github.io" do
Expand All @@ -54,6 +62,10 @@
expect(repo_compat.pages_url).to eql("http://parkr.github.io")
end

it "returns the source" do
expect(repo_compat.source).to eql({ "branch" => "master", "path" => "/" })
end

context "on enterprise" do
it "uses Pages.scheme to determine scheme for pages URL" do
# With SSL=true
Expand Down
16 changes: 16 additions & 0 deletions spec/repository_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
it "forces HTTPS for the URL" do
expect(repo.html_url).to eql("https://hubot.github.com")
end

it "returns the source" do
expect(repo.source).to eql({ "branch" => "gh-pages", "path" => "docs/" })
end
end

context "ben.balter.com" do
Expand All @@ -67,6 +71,10 @@
it "parses the baseurl" do
expect(repo.baseurl).to eql("")
end

it "returns the source" do
expect(repo.source).to eql({ "branch" => "master", "path" => "/" })
end
end

context "parkr.github.io" do
Expand All @@ -88,6 +96,10 @@
it "parses the baseurl" do
expect(repo.baseurl).to eql("")
end

it "returns the source" do
expect(repo.source).to eql({ "branch" => "master", "path" => "/" })
end
end

context "jldec.github.io" do
Expand All @@ -110,6 +122,10 @@
expect(repo.baseurl).to eql("")
end

it "returns the source" do
expect(repo.source).to eql({ "branch" => "master", "path" => "/" })
end

context "on enterprise" do
let!(:stub) { stub_api("/repos/#{nwo}/pages", "jldec_enterprise_repo_pages") }

Expand Down
6 changes: 5 additions & 1 deletion spec/webmock/api_get_benbalter_repo_pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"url": "https://api.github.com/repos/benbalter/benbalter.github.com/pages",
"status": "built",
"cname": "ben.balter.com",
"custom_404": false
"custom_404": false,
"source": {
"branch": "master",
"path": "/"
}
}
6 changes: 5 additions & 1 deletion spec/webmock/api_get_hubot_repo_pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"url": "https://api.github.com/repos/github/hubot.github.com/pages",
"status": "built",
"cname": "hubot.github.com",
"custom_404": false
"custom_404": false,
"source": {
"branch": "gh-pages",
"path": "docs/"
}
}
6 changes: 5 additions & 1 deletion spec/webmock/api_get_jldec_repo_pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"url": "https://api.github.com/repos/jldec/jldec.github.io/pages",
"status": "built",
"html_url": "https://jldec.github.io",
"custom_404": false
"custom_404": false,
"source": {
"branch": "master",
"path": "/"
}
}
6 changes: 5 additions & 1 deletion spec/webmock/api_get_parkr_repo_pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"url": "https://api.github.com/repos/parkr/parkr.github.com/pages",
"status": "built",
"cname": "parkermoore.de",
"custom_404": false
"custom_404": false,
"source": {
"branch": "master",
"path": "/"
}
}

0 comments on commit 7abdfe2

Please sign in to comment.