File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
lib/jekyll-github-metadata Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ def repo_pages_info_opts
105
105
:public_gists ,
106
106
:followers ,
107
107
:following ,
108
+ :hireable ,
108
109
:created_at ,
109
110
:updated_at ,
110
111
] )
@@ -237,6 +238,14 @@ def url_without_path
237
238
uri . dup . tap { |u | u . path = "" } . to_s
238
239
end
239
240
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
+
240
249
private
241
250
242
251
def memoize_value ( var_name , value )
Original file line number Diff line number Diff line change 41
41
end
42
42
end
43
43
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
+
44
63
context "hubot.github.com" do
45
64
let ( :nwo ) { "github/hubot.github.com" }
46
65
let! ( :stub ) { stub_api ( "/repos/#{ nwo } /pages" , "hubot_repo_pages" ) }
You can’t perform that action at this time.
0 commit comments