File tree Expand file tree Collapse file tree
lib/jekyll-github-metadata Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ def repo_pages_info_opts
105105 :public_gists ,
106106 :followers ,
107107 :following ,
108+ :hireable ,
108109 :created_at ,
109110 :updated_at ,
110111 ] )
@@ -237,6 +238,14 @@ def url_without_path
237238 uri . dup . tap { |u | u . path = "" } . to_s
238239 end
239240
241+ def stargazers_count
242+ repo_pages_info [ "stargazers_count" ] || 0
243+ end
244+
245+ def forks_count
246+ repo_pages_info [ "forks_count" ] || 0
247+ end
248+
240249 private
241250
242251 def memoize_value ( var_name , value )
Original file line number Diff line number Diff line change 4141 end
4242 end
4343
44+ context "repository information" do
45+ let ( :nwo ) { "jekyll/jekyll" }
46+ let! ( :stub ) do
47+ stub_api (
48+ "/repos/#{ nwo } /pages" ,
49+ "repo" ,
50+ "Accept" => "application/vnd.github.v3+json"
51+ )
52+ end
53+
54+ it "returns the stargazers_count" do
55+ expect ( repo . stargazers_count ) . to eq ( 22 )
56+ end
57+
58+ it "returns the fork count" do
59+ expect ( repo . forks_count ) . to eq ( 4 )
60+ end
61+ end
62+
4463 context "hubot.github.com" do
4564 let ( :nwo ) { "github/hubot.github.com" }
4665 let! ( :stub ) { stub_api ( "/repos/#{ nwo } /pages" , "hubot_repo_pages" ) }
You can’t perform that action at this time.
0 commit comments