first_github_commit 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/first_github_commit.gemspec +1 -1
- data/lib/first_github_commit.rb +5 -0
- data/test/test_first_github_commit.rb +7 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/first_github_commit.gemspec
CHANGED
data/lib/first_github_commit.rb
CHANGED
@@ -6,6 +6,7 @@ require 'yaml'
|
|
6
6
|
|
7
7
|
class FirstGithubCommit
|
8
8
|
class TooManyRequests < StandardError; end;
|
9
|
+
class RepoNotFound < StandardError; end;
|
9
10
|
|
10
11
|
attr_reader :user, :repo, :requests_made, :page
|
11
12
|
|
@@ -16,6 +17,10 @@ class FirstGithubCommit
|
|
16
17
|
@user, @repo = user, repo
|
17
18
|
@requests_made = 0
|
18
19
|
@range = (1..130)
|
20
|
+
|
21
|
+
# Make sure the repo even exists!
|
22
|
+
raise RepoNotFound if RedirectFollower.new(url_for_page(1)).response.kind_of?(Net::HTTPNotFound)
|
23
|
+
|
19
24
|
find_upper_limit
|
20
25
|
find_page_number
|
21
26
|
end
|
@@ -31,4 +31,11 @@ class TestFirstGithubCommit < Test::Unit::TestCase
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
context "finding a non-existing repo" do
|
35
|
+
should "raise FirstGithubCommit::RepoNotFound" do
|
36
|
+
assert_raise FirstGithubCommit::RepoNotFound do
|
37
|
+
FirstGithubCommit.find('colszowka', 'missing')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
34
41
|
end
|