forked from adarsh/gitsucker
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Gabe Berke-Williams
committed
May 25, 2012
1 parent
3b197f4
commit 405dc18
Showing
4 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,21 @@ | |
end | ||
end | ||
|
||
describe Gitsucker::Author, '#==' do | ||
it 'returns true for two authors with the same name' do | ||
Gitsucker::Author.new('same').should == Gitsucker::Author.new('same') | ||
end | ||
|
||
it 'returns false for two authors with different names' do | ||
Gitsucker::Author.new('one').should_not == Gitsucker::Author.new('two') | ||
end | ||
|
||
it 'returns false for an author and a non-authors with the same name' do | ||
non_author = stub('non-Author', :name => 'same') | ||
Gitsucker::Author.new('same').should_not == non_author | ||
end | ||
end | ||
|
||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
gabebw
Owner
|
||
%w(original_repo_count forked_repo_count js_repo_count ruby_repo_count).each do |method_name| | ||
describe Gitsucker::Author, "##{method_name}" do | ||
it 'delegates to the github profile' do | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require 'spec_helper' | ||
|
||
describe Gitsucker::RepoAuthorList do | ||
let(:repo_name) { 'kangaroo' } | ||
it 'shows correct authors' do | ||
stub_github_repo_name_authors(repo_name, %w(one two)) | ||
repo_author_list = Gitsucker::RepoAuthorList.new(repo_name) | ||
repo_author_list.authors.should == [Gitsucker::Author.new('one'), | ||
Gitsucker::Author.new('two')] | ||
end | ||
|
||
def stub_github_repo_name_authors(repo_name, authors) | ||
ShamRack.at('api.github.com', 443).sinatra do | ||
authors.each do |author| | ||
get "/repos/#{author}/#{repo_name}/forks" do | ||
owner_hashes = authors.map do |login| | ||
{ :owner => { :login => login } } | ||
end | ||
JSON.dump(owner_hashes) | ||
end | ||
end | ||
|
||
get "/legacy/repos/search/#{repo_name}" do | ||
usernames = authors.map { |author| { :username => author } } | ||
JSON.dump({ :repositories => usernames }) | ||
end | ||
end | ||
end | ||
end |
Interesting, although github authornames == usernames, which are unique.