Permalink
Browse files

Merge pull request #33 from digital-science/owner-name-with-dashes

ensure that github owner names that include dashes are handled correctly
  • Loading branch information...
2 parents 5acf356 + 0ad83bd commit 14c8ba448bc6b5682f5e297605dca411394ecd24 @sr sr committed Jan 27, 2012
Showing with 15 additions and 2 deletions.
  1. +2 −2 lib/janky/repository.rb
  2. +13 −0 test/janky_test.rb
View
@@ -86,14 +86,14 @@ def builder
#
# Returns the user name as a String.
def github_owner
- uri[/github\.com[\/:](\w+)\//] && $1
+ uri[/github\.com[\/:]([a-zA-Z0-9\-_]+)\//] && $1
end
# Name of this repository on GitHub.
#
# Returns the name as a String.
def github_name
- uri[/github\.com[\/:](\w+)\/([a-zA-Z0-9\-_]+)/] && $2
+ uri[/github\.com[\/:]([a-zA-Z0-9\-_]+)\/([a-zA-Z0-9\-_]+)/] && $2
end
# Name of the Campfire room receiving build notifications.
View
@@ -268,4 +268,17 @@ def setup
assert hubot_build("janky", "master").not_found?
assert hubot_build("github", "master").not_found?
end
+
+ test "github owner is parsed correctly" do
+ repo = Janky::Repository.setup("github/janky")
+ assert_equal "github", repo.github_owner
+ assert_equal "janky", repo.github_name
+ end
+
+ test "owner with a dash is parsed correctly" do
+ repo = Janky::Repository.setup("digital-science/central-ftp-manage")
+ assert_equal "digital-science", repo.github_owner
+ assert_equal "central-ftp-manage", repo.github_name
+ end
+
end

0 comments on commit 14c8ba4

Please sign in to comment.