technicalpickles-le-git 0.0.6 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -4,12 +4,17 @@ bq. French for "Ruby wrapper around the Github API (v2)".
4
4
 
5
5
  Le Git provides a Ruby wrapper around the "The Github API":http://develop.github.com using "rest-client":http://rdoc.info/projects/adamwiggins/rest-client and "happymapper":http://rdoc.info/projects/jnunemaker/happymapper.
6
6
 
7
- h2. Example usage
7
+ h2. Installing
8
8
 
9
9
  <pre>
10
- require 'rubygems'
11
- require 'le_git'
10
+ gem sources -a http://gems.github.com
11
+ sudo gem install technicalpickles-le-git
12
+ </pre>
12
13
 
14
+ h2. Example usage
15
+
16
+ <pre>
17
+ $ irb -rrubygems -rle-git
13
18
  >> user = Github::User.find("dancroak")
14
19
  => #<Github::User:0x110655c @followers=50, @location="Boston", @repos=18, @language="Ruby", @created=#<DateTime: 42413926183/17280,0,2299161>, type"user", fullname"Dan Croak", actions35, name"dancroak", pushed#<DateTime: 106054886255767/43200000,0,2299161, @username="dancroak", @score=3.8655705, @id="user-198">
15
20
 
data/lib/le-git.rb ADDED
@@ -0,0 +1,10 @@
1
+ require 'happymapper'
2
+ require 'rest_client'
3
+
4
+ module Github
5
+ autoload :User, 'le-git/user'
6
+ autoload :Repository, 'le-git/repository'
7
+ autoload :Commit, 'le-git/commit'
8
+ autoload :Parent, 'le-git/parent'
9
+ autoload :ApiResources, 'le-git/resources'
10
+ end
@@ -6,12 +6,19 @@ module Github
6
6
  element :url, String
7
7
  element :id, String
8
8
  element :tree, String
9
+ element 'committed-date', DateTime
10
+ element 'authored-date', DateTime
11
+ has_many :parents, Parent
9
12
 
10
- def self.master(repo_owner, repo_name)
13
+ def self.branch(repo_owner, repo_name, branch)
11
14
  xml = list_commits_resource(repo_owner, repo_name).get
12
15
  parse(xml)
13
16
  end
14
17
 
18
+ def self.master(repo_owner, repo_name)
19
+ branch(repo_owner, repo_name, 'master')
20
+ end
21
+
15
22
  protected
16
23
  extend ApiResources
17
24
  end
@@ -0,0 +1,6 @@
1
+ module Github
2
+ class Parent
3
+ include HappyMapper
4
+ element :id, String
5
+ end
6
+ end
@@ -18,7 +18,7 @@ module Github
18
18
  end
19
19
 
20
20
  def commits(branch = "master")
21
- Github::Commit.master(owner, name)
21
+ Github::Commit.branch(owner, name, branch)
22
22
  end
23
23
 
24
24
  protected
@@ -0,0 +1,23 @@
1
+ module Github
2
+ module ApiResources
3
+ def api_resource
4
+ RestClient::Resource.new("http://github.com/api/v2/xml")
5
+ end
6
+
7
+ def search_user_resource(username)
8
+ api_resource["user/search/#{username}"]
9
+ end
10
+
11
+ def show_repo_resource(name)
12
+ api_resource["repos/show/#{name}"]
13
+ end
14
+
15
+ def show_user_resource(username)
16
+ api_resource["user/show/#{username}"]
17
+ end
18
+
19
+ def list_commits_resource(username, repo, branch = 'master')
20
+ api_resource["commits/list/#{username}/#{repo}/#{branch}"]
21
+ end
22
+ end
23
+ end
@@ -15,15 +15,28 @@ module Github
15
15
  element :pushed, DateTime
16
16
  element :created, DateTime
17
17
  element :location, String
18
+ element 'public-gist-count', Integer
19
+ element 'public-repo-count', Integer
20
+ element 'following-count', Integer
21
+ element 'followers-count', Integer
22
+ element 'created-at', DateTime
23
+ element :login, String
24
+ element :email, String
25
+ element :blog, String
26
+ element :company, String
18
27
 
19
28
  def self.find(username)
29
+ xml = show_user_resource(username).get
30
+ parse(xml)
31
+ end
32
+
33
+ def self.search(username)
20
34
  xml = search_user_resource(username).get
21
- users = parse(xml)
22
- users.first
35
+ parse(xml)
23
36
  end
24
37
 
25
38
  def repositories
26
- Github::Repository.user(name)
39
+ Github::Repository.user(login || username)
27
40
  end
28
41
 
29
42
  protected
data/rails/init.rb CHANGED
@@ -1 +1 @@
1
- require 'le_git'
1
+ require 'le-git'
@@ -1,79 +1,103 @@
1
1
  require File.join(File.dirname(__FILE__), '/test_helper.rb')
2
2
 
3
3
  class GithubCommitTest < Test::Unit::TestCase
4
- context "given a repository, master commits" do
4
+ context "parsing a Github::Commit" do
5
5
  setup do
6
- uri = "http://github.com:80/api/v2/xml/commits/list/dancroak/le-git/master"
7
- fixture_path = File.join(File.dirname(__FILE__),
8
- 'fixtures',
9
- 'master_commits.xml')
6
+ @xml = <<-END
7
+ <commit>
8
+ <message>updating Repository model to use v2 API. associated User &amp; Repository models. filled out complete API for User.</message>
9
+ <parents type="array">
10
+ <parent>
11
+ <id>690c79a261ed5b078c08742b796cb3056f685698</id>
12
+ </parent>
13
+ </parents>
14
+ <url>http://github.com/dancroak/le-git/commit/1f0111c91344062052f65922171d220a06810d4a</url>
15
+ <author>
16
+ <name>Dan Croak</name>
17
+ <email>dcroak@thoughtbot.com</email>
18
+ </author>
19
+ <id>1f0111c91344062052f65922171d220a06810d4a</id>
20
+ <committed-date>2009-05-25T19:11:27-07:00</committed-date>
21
+ <authored-date>2009-05-25T19:11:27-07:00</authored-date>
22
+ <tree>d27ed042222fe8a55681e1af260e3eb2847e9f33</tree>
23
+ <committer>
24
+ <name>Dan Croak</name>
25
+ <email>dcroak@thoughtbot.com</email>
26
+ </committer>
27
+ </commit>
28
+ END
10
29
 
11
- FakeWeb.register_uri(uri, :response => fixture_path)
30
+ @commit = Github::Commit.parse(@xml)
31
+ end
12
32
 
13
- begin
14
- @commits = Github::Commit.master("dancroak", "le-git")
15
- rescue # can't figure out Net::HTTPBadResponse: wrong status line
16
- @commits = Github::Commit.parse(File.read(fixture_path))
17
- end
33
+ test "#message" do
34
+ @commit.message.should == "updating Repository model to use v2 API. associated User & Repository models. filled out complete API for User."
18
35
  end
19
36
 
20
- test "size" do
21
- @commits.size.should == 30
37
+ test "#parents size" do
38
+ @commit.parents.size.should == 1
39
+ @commit.parents.first.id.should == "690c79a261ed5b078c08742b796cb3056f685698"
22
40
  end
23
41
 
24
- context "first commit" do
25
- setup do
26
- @commit = @commits.first
27
- end
42
+ test "#url" do
43
+ @commit.url.should == "http://github.com/dancroak/le-git/commit/1f0111c91344062052f65922171d220a06810d4a"
44
+ end
28
45
 
29
- test "#message" do
30
- @commit.message.should == "updating Repository model to use v2 API. associated User & Repository models. filled out complete API for User."
46
+ test "#author" do
47
+ pending "could do has_one :author, User, but it seems to expect the element to be :author" do
48
+ @commit.author.name.should == "Dan Croak"
49
+ @commit.author.email.should == "dcroak@thoughtbot.com"
31
50
  end
51
+ end
32
52
 
33
- test "#parents size" do
34
- pending "how to do arrays?" do
35
- @commit.parents.size.should == 1
36
- @commits.parents.first.id.should == "690c79a261ed5b078c08742b796cb3056f685698"
37
- end
38
- end
53
+ test "#id" do
54
+ @commit.id.should == "1f0111c91344062052f65922171d220a06810d4a"
55
+ end
39
56
 
40
- test "#url" do
41
- @commit.url.should == "http://github.com/dancroak/le-git/commit/1f0111c91344062052f65922171d220a06810d4a"
42
- end
57
+ test "#commited_date" do
58
+ @commit.committed_date.should == DateTime.parse("2009-05-25T19:11:27-07:00")
59
+ end
43
60
 
44
- test "#author" do
45
- pending "how to do arrays?" do
46
- @commit.author.name.should == "Dan Croak"
47
- @commit.author.email.should == "dcroak@thoughtbot.com"
48
- end
49
- end
61
+ test "#authored_date" do
62
+ @commit.authored_date.should == DateTime.parse("2009-05-25T19:11:27-07:00")
63
+ end
50
64
 
51
- test "#id" do
52
- @commit.id.should == "1f0111c91344062052f65922171d220a06810d4a"
53
- end
65
+ test "#tree" do
66
+ @commit.tree.should == "d27ed042222fe8a55681e1af260e3eb2847e9f33"
67
+ end
54
68
 
55
- test "#commited_date" do
56
- pending "HappyMapper can't handle nodes with dashes" do
57
- @commit.committed_date.should == Date.parse("2009-05-25T19:11:27-07:00")
58
- end
69
+ test "#committer" do
70
+ pending "how to do arrays?" do
71
+ @commit.committer.name.should == "Dan Croak"
72
+ @commit.committer.email.should == "dcroak@thoughtbot.com"
59
73
  end
74
+ end
75
+ end
60
76
 
61
- test "#authored_date" do
62
- pending "HappyMapper can't handle nodes with dashes" do
63
- @commit.authored_date.should == Date.parse("2009-05-25T19:11:27-07:00")
64
- end
65
- end
77
+ context "Commits for a user's repository's branch" do
78
+ setup do
79
+ uri = "http://github.com:80/api/v2/xml/commits/list/dancroak/le-git/master"
80
+ fixture_path = File.join(File.dirname(__FILE__),
81
+ 'fixtures',
82
+ 'master_commits.xml')
66
83
 
67
- test "#tree" do
68
- @commit.tree.should == "d27ed042222fe8a55681e1af260e3eb2847e9f33"
69
- end
84
+ FakeWeb.register_uri(uri, :response => fixture_path)
70
85
 
71
- test "#committer" do
72
- pending "how to do arrays?" do
73
- @commit.committer.name.should == "Dan Croak"
74
- @commit.committer.email.should == "dcroak@thoughtbot.com"
75
- end
86
+ begin
87
+ @commits = Github::Commit.branch("dancroak", "le-git", "master")
88
+ rescue # can't figure out Net::HTTPBadResponse: wrong status line
89
+ @commits = Github::Commit.parse(File.read(fixture_path))
76
90
  end
77
91
  end
92
+
93
+ test "size" do
94
+ @commits.size.should == 30
95
+ end
96
+ end
97
+
98
+ test "Commit's for user's repository's master" do
99
+ commits = Object.new
100
+ mock(Github::Commit).branch("dancroak", "le-git", "master") { commits }
101
+ Github::Commit.master("dancroak", "le-git").should == commits
78
102
  end
79
103
  end
@@ -0,0 +1,20 @@
1
+ require File.join(File.dirname(__FILE__), '/test_helper.rb')
2
+
3
+ class GithubParentTest < Test::Unit::TestCase
4
+ context "parsing a Github::Parent" do
5
+ setup do
6
+ xml = <<-END
7
+ <parent>
8
+ <id>690c79a261ed5b078c08742b796cb3056f685698</id>
9
+ </parent>
10
+ END
11
+
12
+ @parent = Github::Parent.parse(xml)
13
+ end
14
+
15
+ test "#id" do
16
+ @parent.id.should == "690c79a261ed5b078c08742b796cb3056f685698"
17
+ end
18
+ end
19
+ end
20
+
@@ -1,6 +1,61 @@
1
1
  require File.join(File.dirname(__FILE__), '/test_helper.rb')
2
2
 
3
3
  class GithubRepositoryTest < Test::Unit::TestCase
4
+ context "parsing a found Github::Repository" do
5
+ setup do
6
+ @xml = <<-END
7
+ <repository>
8
+ <description>Rails plugin. Force major browsers (IE, Firefox, Safari) to reload a page, even when triggered by 'back' button.</description>
9
+ <name>no_cache</name>
10
+ <private type="boolean">false</private>
11
+ <url>http://github.com/dancroak/no_cache</url>
12
+ <fork type="boolean">false</fork>
13
+ <watchers type="integer">10</watchers>
14
+ <forks type="integer">0</forks>
15
+ <owner>dancroak</owner>
16
+ <homepage>http://giantrobots.thoughtbot.com</homepage>
17
+ </repository>
18
+ END
19
+ @repository = Github::Repository.parse(@xml)
20
+ end
21
+
22
+ test "#description" do
23
+ @repository.description.should == "Rails plugin. Force major browsers (IE, Firefox, Safari) to reload a page, even when triggered by 'back' button."
24
+ end
25
+
26
+ test "#name" do
27
+ @repository.name.should == "no_cache"
28
+ end
29
+
30
+ test "#private" do
31
+ @repository.private.should == false
32
+ end
33
+
34
+ test "#url" do
35
+ @repository.url.should == "http://github.com/dancroak/no_cache"
36
+ end
37
+
38
+ test "#fork" do
39
+ @repository.fork.should == false
40
+ end
41
+
42
+ test "#watchers" do
43
+ @repository.watchers.should == 10
44
+ end
45
+
46
+ test "#forks" do
47
+ @repository.forks.should == 0
48
+ end
49
+
50
+ test "#owner" do
51
+ @repository.owner.should == "dancroak"
52
+ end
53
+
54
+ test "#homepage" do
55
+ @repository.homepage.should == "http://giantrobots.thoughtbot.com"
56
+ end
57
+ end
58
+
4
59
  context "a Github::Repository found via user" do
5
60
  setup do
6
61
  fixture_path = File.join(File.dirname(__FILE__),
@@ -12,6 +67,13 @@ class GithubRepositoryTest < Test::Unit::TestCase
12
67
  @repositories = Github::Repository.user("dancroak")
13
68
  end
14
69
 
70
+ test "returned kind" do
71
+ @repositories.class.should == Array
72
+ @repositories.each do |repository|
73
+ repository.class.should == Github::Repository
74
+ end
75
+ end
76
+
15
77
  test "size" do
16
78
  @repositories.size.should == 19
17
79
  end
@@ -21,84 +83,19 @@ class GithubRepositoryTest < Test::Unit::TestCase
21
83
  @repository = @repositories.first
22
84
  end
23
85
 
24
- test "#description" do
25
- @repository.description.should == "Rails plugin. Force major browsers (IE, Firefox, Safari) to reload a page, even when triggered by 'back' button."
86
+ test "#commits" do
87
+ commits = Object.new
88
+ mock(Github::Commit).branch(@repository.owner, @repository.name, 'master') { commits }
89
+ @repository.commits.should == commits
26
90
  end
27
91
 
28
- test "#name" do
29
- @repository.name.should == "no_cache"
30
- end
31
-
32
- test "#private" do
33
- @repository.private.should == false
34
- end
35
-
36
- test "#url" do
37
- @repository.url.should == "http://github.com/dancroak/no_cache"
38
- end
92
+ test "#commits(redesign)" do
93
+ commits = Object.new
94
+ mock(Github::Commit).branch(@repository.owner, @repository.name, 'redesign') { commits }
95
+ @repository.commits('redesign').should == commits
39
96
 
40
- test "#fork" do
41
- @repository.fork.should == false
42
97
  end
43
98
 
44
- test "#watchers" do
45
- @repository.watchers.should == 10
46
- end
47
-
48
- test "#forks" do
49
- @repository.forks.should == 0
50
- end
51
-
52
- test "#owner" do
53
- @repository.owner.should == "dancroak"
54
- end
55
-
56
- test "#homepage" do
57
- @repository.homepage.should == "http://giantrobots.thoughtbot.com"
58
- end
59
-
60
- context "master commits" do
61
- setup do
62
- uri = "http://github.com:80/api/v2/xml/commits/list/dancroak/le-git/master"
63
- fixture_path = File.join(File.dirname(__FILE__),
64
- 'fixtures',
65
- 'master_commits.xml')
66
-
67
- FakeWeb.register_uri(uri, :response => fixture_path)
68
-
69
- begin
70
- @commits = @repository.commits
71
- rescue # can't figure out Net::HTTPBadResponse: wrong status line
72
- @commits = Github::Commit.parse(File.read(fixture_path))
73
- end
74
- end
75
-
76
- test "size" do
77
- @commits.size.should == 30
78
- end
79
-
80
- context "first commit" do
81
- setup do
82
- @commit = @commits.first
83
- end
84
-
85
- test "#message" do
86
- @commit.message.should == "updating Repository model to use v2 API. associated User & Repository models. filled out complete API for User."
87
- end
88
-
89
- test "#url" do
90
- @commit.url.should == "http://github.com/dancroak/le-git/commit/1f0111c91344062052f65922171d220a06810d4a"
91
- end
92
-
93
- test "#id" do
94
- @commit.id.should == "1f0111c91344062052f65922171d220a06810d4a"
95
- end
96
-
97
- test "#tree" do
98
- @commit.tree.should == "d27ed042222fe8a55681e1af260e3eb2847e9f33"
99
- end
100
- end
101
- end
102
99
  end
103
100
  end
104
101
  end
@@ -1,21 +1,44 @@
1
1
  require File.join(File.dirname(__FILE__), '/test_helper.rb')
2
2
 
3
3
  class GithubUserTest < Test::Unit::TestCase
4
- context "A Github::User" do
4
+ context "searching users" do
5
5
  setup do
6
- fixture_path = File.join(File.dirname(__FILE__), 'fixtures', 'user.xml')
7
- FakeWeb.register_uri('http://github.com/api/v2/xml/user/search/dancroak',
6
+ fixture_path = File.join(File.dirname(__FILE__), 'fixtures', 'search_users.xml')
7
+ FakeWeb.register_uri('http://github.com/api/v2/xml/user/search/tech',
8
8
  :response => fixture_path)
9
9
 
10
- @user = Github::User.find('dancroak')
10
+ @users = Github::User.search('tech')
11
11
  end
12
12
 
13
- test "#score" do
14
- @user.score.should == 3.8653853
13
+ test "#size" do
14
+ @users.size.should == 19
15
15
  end
16
+ end
16
17
 
17
- test "#name" do
18
- @user.name.should == "dancroak"
18
+ context "parsing a Github::User search result" do
19
+ setup do
20
+ @xml = <<-XML
21
+ <user>
22
+ <score type="float">2.3766692</score>
23
+ <name>techcrunch</name>
24
+ <actions type="integer">35</actions>
25
+ <language>PHP</language>
26
+ <followers type="integer">24</followers>
27
+ <username>techcrunch</username>
28
+ <type>user</type>
29
+ <fullname>TechCrunch</fullname>
30
+ <repos type="integer">2</repos>
31
+ <id>user-14080</id>
32
+ <pushed>2009-05-17T09:15:35.542Z</pushed>
33
+ <created>2008-06-17T19:10:49Z</created>
34
+ <location>Atherton, CA</location>
35
+ </user>
36
+ XML
37
+ @user = Github::User.parse(@xml)
38
+ end
39
+
40
+ test "#score" do
41
+ @user.score.should == 2.3766692
19
42
  end
20
43
 
21
44
  test "#actions" do
@@ -23,101 +46,124 @@ class GithubUserTest < Test::Unit::TestCase
23
46
  end
24
47
 
25
48
  test "#language" do
26
- @user.language.should == "Ruby"
27
- end
28
-
29
- test "#followers" do
30
- @user.followers.should == 50
49
+ @user.language.should == "PHP"
31
50
  end
32
51
 
33
52
  test "#username" do
34
- @user.username.should == "dancroak"
35
- end
36
-
37
- test "#type" do
38
- @user.type.should == "user"
53
+ @user.username.should == "techcrunch"
39
54
  end
40
55
 
41
56
  test "#fullname" do
42
- @user.fullname.should == "Dan Croak"
43
- end
44
-
45
- test "#repos" do
46
- @user.repos.should == 18
57
+ @user.fullname.should == "TechCrunch"
47
58
  end
48
59
 
49
60
  test "#id" do
50
- @user.id.should == "user-198"
61
+ @user.id.should == "user-14080"
51
62
  end
52
63
 
53
64
  test "#pushed" do
54
- @user.pushed.to_s.should == DateTime.new(2009, 5, 22, 17, 15, 11).to_s
65
+ @user.pushed.should == DateTime.parse("2009-05-17T09:15:35.542Z")
55
66
  end
56
67
 
57
68
  test "#created" do
58
- @user.created.to_s.should == DateTime.new(2008, 2, 13, 2, 48, 35).to_s
69
+ @user.created.should == DateTime.parse("2008-06-17T19:10:49Z")
59
70
  end
60
71
 
61
72
  test "#location" do
62
- @user.location.should == "Boston"
73
+ @user.location.should == "Atherton, CA"
74
+ end
75
+
76
+ end
77
+
78
+ context "parsing a found Github::User" do
79
+ setup do
80
+ @xml = <<-XML
81
+ <user>
82
+ <name>Dan Croak</name>
83
+ <company>thoughtbot</company>
84
+ <following-count type="integer">76</following-count>
85
+ <public-gist-count type="integer">52</public-gist-count>
86
+ <public-repo-count type="integer">21</public-repo-count>
87
+ <blog>http://dancroak.com</blog>
88
+ <id type="integer">198</id>
89
+ <followers-count type="integer">52</followers-count>
90
+ <login>dancroak</login>
91
+ <location>Boston</location>
92
+ <email>dcroak@thoughtbot.com</email>
93
+ <created-at type="datetime">2008-02-12T18:48:35-08:00</created-at>
94
+ </user>
95
+ XML
96
+
97
+ @user = Github::User.parse(@xml)
98
+ end
99
+
100
+ test "#name" do
101
+ @user.name.should == "Dan Croak"
63
102
  end
64
103
 
65
- context "GETing #repositories" do
66
- setup do
67
- fixture_path = File.join(File.dirname(__FILE__),
68
- 'fixtures',
69
- 'user_repositories.xml')
70
- FakeWeb.register_uri('http://github.com/api/v2/xml/repos/show/dancroak',
71
- :response => fixture_path)
104
+ test "#company" do
105
+ @user.company.should == "thoughtbot"
106
+ end
107
+
108
+ test "#following_count" do
109
+ @user.following_count.should == 76
110
+ end
72
111
 
73
- @repositories = @user.repositories
74
- end
112
+ test "#public_gist_count" do
113
+ @user.public_gist_count.should == 52
114
+ end
115
+
116
+ test "#public_repo_count" do
117
+ @user.public_repo_count.should == 21
118
+ end
75
119
 
76
- test "size" do
77
- @repositories.size.should == 19
78
- end
120
+ test "#blog" do
121
+ @user.blog.should == "http://dancroak.com"
122
+ end
79
123
 
80
- context "first" do
81
- setup do
82
- @repository = @repositories.first
83
- end
124
+ test "#id" do
125
+ @user.id.should == "198"
126
+ end
84
127
 
85
- test "#description" do
86
- @repository.description.should == "Rails plugin. Force major browsers (IE, Firefox, Safari) to reload a page, even when triggered by 'back' button."
87
- end
128
+ test "#followers_count" do
129
+ @user.followers_count.should == 52
130
+ end
88
131
 
89
- test "#name" do
90
- @repository.name.should == "no_cache"
91
- end
132
+ test "#login" do
133
+ @user.login.should == "dancroak"
134
+ end
92
135
 
93
- test "#private" do
94
- @repository.private.should == false
95
- end
136
+ test "#location" do
137
+ @user.location.should == "Boston"
138
+ end
96
139
 
97
- test "#url" do
98
- @repository.url.should == "http://github.com/dancroak/no_cache"
99
- end
140
+ test "#email" do
141
+ @user.email.should == "dcroak@thoughtbot.com"
142
+ end
100
143
 
101
- test "#fork" do
102
- @repository.fork.should == false
103
- end
144
+ test "#created_at" do
145
+ @user.created_at.should == DateTime.parse("2008-02-12T18:48:35-08:00")
146
+ end
147
+ end
104
148
 
105
- test "#watchers" do
106
- @repository.watchers.should == 10
107
- end
149
+ context "A found Github::User" do
150
+ setup do
151
+ fixture_path = File.join(File.dirname(__FILE__), 'fixtures', 'user.xml')
152
+ FakeWeb.register_uri('http://github.com/api/v2/xml/user/show/dancroak',
153
+ :response => fixture_path)
108
154
 
109
- test "#forks" do
110
- @repository.forks.should == 0
111
- end
155
+ @user = Github::User.find('dancroak')
156
+ end
112
157
 
113
- test "#owner" do
114
- @repository.owner.should == "dancroak"
115
- end
158
+ test "returned kind" do
159
+ @user.class.should == Github::User
160
+ end
116
161
 
117
- test "#homepage" do
118
- @repository.homepage.should == "http://giantrobots.thoughtbot.com"
119
- end
120
- end
162
+ test "#repositories" do
163
+ repositories = Object.new
164
+ mock(Github::Repository).user(@user.login) { repositories }
165
+ @user.repositories.should == repositories
121
166
  end
167
+
122
168
  end
123
169
  end
data/test/test_helper.rb CHANGED
@@ -14,7 +14,11 @@ CONTEXT_NOISE = %w(context)
14
14
  require 'context'
15
15
  require 'matchy'
16
16
  require 'pending'
17
+ require 'rr'
17
18
 
18
19
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib') )
19
- require 'le_git'
20
+ require 'le-git'
20
21
 
22
+ class Test::Unit::TestCase
23
+ include RR::Adapters::TestUnit unless include?(RR::Adapters::TestUnit)
24
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: technicalpickles-le-git
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Nichols
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-05-25 00:00:00 -07:00
13
+ date: 2009-06-12 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -45,12 +45,14 @@ extra_rdoc_files:
45
45
  files:
46
46
  - LICENSE
47
47
  - README.textile
48
- - lib/le_git.rb
49
- - lib/le_git/commit.rb
50
- - lib/le_git/repository.rb
51
- - lib/le_git/user.rb
48
+ - lib/le-git.rb
49
+ - lib/le-git/commit.rb
50
+ - lib/le-git/parent.rb
51
+ - lib/le-git/repository.rb
52
+ - lib/le-git/resources.rb
53
+ - lib/le-git/user.rb
52
54
  - rails/init.rb
53
- has_rdoc: false
55
+ has_rdoc: true
54
56
  homepage: http://github.com/dancroak/le-git
55
57
  post_install_message:
56
58
  rdoc_options:
@@ -74,10 +76,11 @@ requirements: []
74
76
  rubyforge_project:
75
77
  rubygems_version: 1.2.0
76
78
  signing_key:
77
- specification_version: 3
79
+ specification_version: 2
78
80
  summary: Ruby wrapper around Github API v2
79
81
  test_files:
80
82
  - test/github_commit_test.rb
83
+ - test/github_parent_test.rb
81
84
  - test/github_repository_test.rb
82
85
  - test/github_user_test.rb
83
86
  - test/test_helper.rb
data/lib/le_git.rb DELETED
@@ -1,9 +0,0 @@
1
- require 'happymapper'
2
- require 'rest_client'
3
-
4
- module Github
5
- autoload :User, 'le_git/user'
6
- autoload :Repository, 'le_git/repository'
7
- autoload :Commit, 'le_git/commit'
8
- autoload :ApiResources, 'le_git/resources'
9
- end