Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add site.github.public_repositories[].contributors #234

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/jekyll-github-metadata/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def owner_public_repositories
}
memoize_value :@owner_public_repositories, Value.new("owner_public_repositories", proc do |c|
c.list_repos(owner, options).each { |r| r[:releases] = c.releases(r[:full_name]) }
c.list_repos(owner, options).each { |r| r[:contributors] = c.contributors(r[:full_name], options) }
9bow marked this conversation as resolved.
Show resolved Hide resolved
end)
end

Expand Down
8 changes: 8 additions & 0 deletions spec/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@
expect(subject["public_repositories"].first["releases"].first["target_commitish"]).to eql("master")
end

it "contains the correct public_repositories.contributors" do
expect(subject).to have_key("public_repositories")
expect(subject["public_repositories"].first).to have_key("contributors")
expect(subject["public_repositories"].first["contributors"].size).to eql(1)
expect(subject["public_repositories"].first["contributors"].first["login"]).to eql("parkr")
expect(subject["public_repositories"].first["contributors"].first["id"]).to eql(237985)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rubocop is failing on this line. I think it's unnecessary so I'd recommend that you remove this line.

end

it "calls all the stubs" do
stubs.each do |stub|
expect(stub).to have_been_requested
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helpers/stub_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def stub_all_api_requests

owner_repos = JSON.parse(webmock_data("owner_repos"))
owner_repos.each { |r| stubs << stub_api("/repos/#{r["full_name"]}/releases?per_page=100", "repo_releases") }
owner_repos.each { |r| stubs << stub_api("/repos/#{r["full_name"]}/contributors?per_page=100", "repo_contributors") }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From Rubocop:

Style/CombinableLoops: Combine this loop with the previous loop.


stubs
end
Expand Down