octokit 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. data/lib/octokit/client.rb +0 -4
  2. data/lib/octokit/client/commits.rb +61 -3
  3. data/lib/octokit/client/issues.rb +0 -1
  4. data/lib/octokit/client/objects.rb +65 -20
  5. data/lib/octokit/client/organizations.rb +1 -6
  6. data/lib/octokit/client/repositories.rb +0 -5
  7. data/lib/octokit/client/users.rb +1 -7
  8. data/lib/octokit/version.rb +1 -1
  9. data/spec/fixtures/{v2 → legacy}/issues.json +0 -0
  10. data/spec/fixtures/{v2 → legacy}/repositories.json +0 -0
  11. data/spec/fixtures/{v2 → legacy}/users.json +0 -0
  12. data/spec/fixtures/v3/blob_create.json +3 -0
  13. data/spec/fixtures/v3/commit_create.json +25 -0
  14. data/spec/fixtures/v3/tree_create.json +14 -0
  15. data/spec/octokit/client/commits_spec.rb +16 -0
  16. data/spec/octokit/client/issues_spec.rb +1 -1
  17. data/spec/octokit/client/objects_spec.rb +23 -41
  18. data/spec/octokit/client/organizations_spec.rb +5 -20
  19. data/spec/octokit/client/repositories_spec.rb +1 -12
  20. data/spec/octokit/client/users_spec.rb +1 -12
  21. metadata +38 -54
  22. data/lib/octokit/client/network.rb +0 -15
  23. data/lib/octokit/client/timelines.rb +0 -21
  24. data/spec/fixtures/timeline.json +0 -1408
  25. data/spec/fixtures/v2/blob_metadata.json +0 -2052
  26. data/spec/fixtures/v2/blobs.json +0 -260
  27. data/spec/fixtures/v2/network_data.json +0 -3551
  28. data/spec/fixtures/v2/network_meta.json +0 -2530
  29. data/spec/fixtures/v2/raw.txt +0 -7
  30. data/spec/fixtures/v2/tree_metadata.json +0 -2612
  31. data/spec/fixtures/v2/user.json +0 -19
  32. data/spec/octokit/client/network_spec.rb +0 -32
  33. data/spec/octokit/client/timelines_spec.rb +0 -42
@@ -9,7 +9,6 @@ require 'octokit/client/downloads'
9
9
  require 'octokit/client/gists'
10
10
  require 'octokit/client/issues'
11
11
  require 'octokit/client/labels'
12
- require 'octokit/client/network'
13
12
  require 'octokit/client/milestones'
14
13
  require 'octokit/client/objects'
15
14
  require 'octokit/client/organizations'
@@ -17,7 +16,6 @@ require 'octokit/client/pub_sub_hubbub'
17
16
  require 'octokit/client/pub_sub_hubbub/service_hooks'
18
17
  require 'octokit/client/pulls'
19
18
  require 'octokit/client/repositories'
20
- require 'octokit/client/timelines'
21
19
  require 'octokit/client/users'
22
20
  require 'octokit/client/events'
23
21
  require 'octokit/client/authorizations'
@@ -43,7 +41,6 @@ module Octokit
43
41
  include Octokit::Client::Gists
44
42
  include Octokit::Client::Issues
45
43
  include Octokit::Client::Labels
46
- include Octokit::Client::Network
47
44
  include Octokit::Client::Milestones
48
45
  include Octokit::Client::Objects
49
46
  include Octokit::Client::Organizations
@@ -51,7 +48,6 @@ module Octokit
51
48
  include Octokit::Client::PubSubHubbub
52
49
  include Octokit::Client::PubSubHubbub::ServiceHooks
53
50
  include Octokit::Client::Repositories
54
- include Octokit::Client::Timelines
55
51
  include Octokit::Client::Users
56
52
  include Octokit::Client::Events
57
53
  include Octokit::Client::Authorizations
@@ -2,24 +2,82 @@ module Octokit
2
2
  class Client
3
3
  module Commits
4
4
 
5
- def commits(repo, branch="master", options={})
6
- options = { :per_page => 35, :sha => branch }.merge options
7
- get("/repos/#{Repository.new(repo)}/commits", options, 3)
5
+ # List commits
6
+ #
7
+ # Optionally pass <tt>path => "path/to/file.rb"</tt> in <tt>options</tt> to
8
+ # only return commits containing the given file path.
9
+ #
10
+ # @param repo [String, Hash, Repository] A GitHub repository
11
+ # @param sha_or_branch [String] Commit SHA or branch name from which to start the list
12
+ # @return [Array] An array of hashes representing commits
13
+ # @see http://developer.github.com/v3/repos/commits/
14
+ def commits(repo, sha_or_branch="master", options={})
15
+ params = { :sha => sha_or_branch, :per_page => 35 }
16
+ get("/repos/#{Repository.new(repo)}/commits", options.merge(params), 3)
8
17
  end
9
18
  alias :list_commits :commits
10
19
 
20
+ # Get a single commit
21
+ #
22
+ # @param repo [String, Hash, Repository] A GitHub repository
23
+ # @param sha [String] The SHA of the commit to fetch
24
+ # @return [Hashie::Mash] A hash representing the commit
25
+ # @see http://developer.github.com/v3/repos/commits/
11
26
  def commit(repo, sha, options={})
12
27
  get("/repos/#{Repository.new(repo)}/commits/#{sha}", options, 3)
13
28
  end
14
29
 
30
+ # Create a commit
31
+ #
32
+ # Optionally pass <tt>author</tt> and <tt>committer</tt> hashes in <tt>options</tt>
33
+ # if you'd like manual control over those parameters. If absent, details will be
34
+ # inferred from the authenticated user. See <a href="http://developer.github.com/v3/git/commits/">GitHub's documentation</a>
35
+ # for details about how to format committer identities.
36
+ #
37
+ # @param repo [String, Hash, Repository] A GitHub repository
38
+ # @param message [String] The commit message
39
+ # @param tree [String] The SHA of the tree object the new commit will point to
40
+ # @param parents [String, Array] One SHA (for a normal commit) or an array of SHAs (for a merge) of the new commit's parent commits. If ommitted or empty, a root commit will be created
41
+ # @return [Hashie::Mash] A hash representing the new commit
42
+ # @see http://developer.github.com/v3/git/commits/
43
+ # @example Create a commit
44
+ # commit = Octokit.create_commit("octocat/Hello-World", "My commit message", "827efc6d56897b048c772eb4087f854f46256132", "7d1b31e74ee336d15cbd21741bc88a537ed063a0")
45
+ # commit.sha # => "7638417db6d59f3c431d3e1f261cc637155684cd"
46
+ # commit.tree.sha # => "827efc6d56897b048c772eb4087f854f46256132"
47
+ # commit.message # => "My commit message"
48
+ # commit.committer # => { "name" => "Wynn Netherland", "email" => "wynn@github.com", ... }
49
+ def create_commit(repo, message, tree, parents=nil, options={})
50
+ params = { :message => message, :tree => tree }.tap do |params|
51
+ params[:parents] = [parents].flatten if parents
52
+ end
53
+ post("/repos/#{Repository.new(repo)}/git/commits", options.merge(params), 3)
54
+ end
55
+
56
+ # List all commit comments
57
+ #
58
+ # @param repo [String, Hash, Repository] A GitHub repository
59
+ # @return [Array] An array of hashes representing comments
60
+ # @see http://developer.github.com/v3/repos/comments/
15
61
  def list_commit_comments(repo, options={})
16
62
  get("/repos/#{Repository.new(repo)}/comments", options, 3)
17
63
  end
18
64
 
65
+ # List comments for a single commit
66
+ #
67
+ # @param repo [String, Hash, Repository] A GitHub repository
68
+ # @param sha [String] The SHA of the commit whose comments will be fetched
69
+ # @return [Array] An array of hashes representing comments
70
+ # @see http://developer.github.com/v3/repos/comments/
19
71
  def commit_comments(repo, sha, options={})
20
72
  get("/repos/#{Repository.new(repo)}/commits/#{sha}/comments", options, 3)
21
73
  end
22
74
 
75
+ # Get a single commit comment
76
+ #
77
+ # @param repo [String, Hash, Repository] A GitHub repository
78
+ # @param id [String] The ID of the comment to fetch
79
+ # @return [Hashie::Mash] A hash representing the comment
80
+ # @see http://developer.github.com/v3/repos/comments/
23
81
  def commit_comment(repo, id, options={})
24
82
  get("/repos/#{Repository.new(repo)}/comments/#{id}", options, 3)
25
83
  end
@@ -11,7 +11,6 @@ module Octokit
11
11
  # @see http://develop.github.com/p/issues.html
12
12
  # @example Search for 'test' in the open issues for sferik/rails_admin
13
13
  # Octokit.search_issues("sferik/rails_admin", 'test', 'open')
14
- # @deprecated Please use `list_issues` instead
15
14
  def search_issues(repo, search_term, state='open', options={})
16
15
  get("/legacy/issues/search/#{Repository.new(repo)}/#{state}/#{search_term}", options, 3)['issues']
17
16
  end
@@ -1,34 +1,79 @@
1
1
  module Octokit
2
2
  class Client
3
3
  module Objects
4
+ # Get a single tree, fetching information about its root-level objects
5
+ #
6
+ # Pass <tt>:recursive => true</tt> in <tt>options</tt> to fetch information about all of the tree's objects, including those in subdirectories.
7
+ #
8
+ # @param repo [String, Hash, Repository] A GitHub repository
9
+ # @param tree_sha [String] The SHA of the tree to fetch
10
+ # @return [Hashie::Mash] A hash representing the fetched tree
11
+ # @see http://developer.github.com/v3/git/trees/
12
+ # @example Fetch a tree and inspect the path of one of its files
13
+ # tree = Octokit.tree("octocat/Hello-World", "9fb037999f264ba9a7fc6274d15fa3ae2ab98312")
14
+ # tree.tree.first.path # => "file.rb"
15
+ # @example Fetch a tree recursively
16
+ # tree = Octokit.tree("octocat/Hello-World", "fc6274d15fa3ae2ab983129fb037999f264ba9a7")
17
+ # tree.tree.first.path # => "subdir/file.txt"
4
18
  def tree(repo, tree_sha, options={})
5
19
  get("repos/#{Repository.new(repo)}/git/trees/#{tree_sha}", options)
6
20
  end
7
21
 
8
- def blob(repo, tree_sha, options={})
9
- get("repos/#{Repository.new(repo)}/git/blobs/#{tree_sha}", options)
22
+ # Create a tree
23
+ #
24
+ # Pass <tt>:base_tree => "827efc6..."</tt> in <tt>options</tt> to update an existing tree with new data.
25
+ #
26
+ # @param repo [String, Hash, Repository] A GitHub repository
27
+ # @param tree [Array] An array of hashes representing a tree structure
28
+ # @return [Hashie::Mash] A hash representing the new tree
29
+ # @see http://developer.github.com/v3/git/trees/
30
+ # @example Create a tree containing one file
31
+ # tree = Octokit.create_tree("octocat/Hello-World", [ { :path => "file.rb", :mode => "100644", :type => "blob", :sha => "44b4fc6d56897b048c772eb4087f854f46256132" } ])
32
+ # tree.sha # => "cd8274d15fa3ae2ab983129fb037999f264ba9a7"
33
+ # tree.tree.first.path # => "file.rb"
34
+ def create_tree(repo, tree, options={})
35
+ parameters = { :tree => tree }
36
+ post("/repos/#{Repository.new(repo)}/git/trees", options.merge(parameters), 3)
10
37
  end
11
38
 
12
- def blobs(repo, tree_sha, options={})
13
- warn 'DEPRECATED: Please use Octokit.tree instead.'
14
- get("/api/v2/json/blob/all/#{Repository.new(repo)}/#{tree_sha}", options, 2)['blobs']
39
+ # Get a single blob, fetching its content and encoding
40
+ #
41
+ # @param repo [String, Hash, Repository] A GitHub repository
42
+ # @param blob_sha [String] The SHA of the blob to fetch
43
+ # @return [Hashie::Mash] A hash representing the fetched blob
44
+ # @see http://developer.github.com/v3/git/blobs/
45
+ # @example Fetch a blob and inspect its contents
46
+ # blob = Octokit.blob("octocat/Hello-World", "827efc6d56897b048c772eb4087f854f46256132")
47
+ # blob.encoding # => "utf-8"
48
+ # blob.content # => "Foo bar baz"
49
+ # @example Fetch a base64-encoded blob and inspect its contents
50
+ # require "base64"
51
+ # blob = Octokit.blob("octocat/Hello-World", "827efc6d56897b048c772eb4087f854f46256132")
52
+ # blob.encoding # => "base64"
53
+ # blob.content # => "Rm9vIGJhciBiYXo="
54
+ # Base64.decode64(blob.content) # => "Foo bar baz"
55
+ def blob(repo, blob_sha, options={})
56
+ get("repos/#{Repository.new(repo)}/git/blobs/#{blob_sha}", options)
15
57
  end
16
58
 
17
- def blob_metadata(repo, tree_sha, options={})
18
- warn 'DEPRECATED: Please use Octokit.blob instead.'
19
- get("/api/v2/json/blob/full/#{Repository.new(repo)}/#{tree_sha}", options, 2)['blobs']
20
- end
21
- alias :blob_meta :blob_metadata
22
-
23
- def tree_metadata(repo, tree_sha, options={})
24
- warn 'DEPRECATED: Please use Octokit.tree instead.'
25
- get("/api/v2/json/tree/full/#{Repository.new(repo)}/#{tree_sha}", options, 2)['tree']
26
- end
27
- alias :tree_meta :tree_metadata
28
-
29
- def raw(repo, sha, options={})
30
- warn 'DEPRECATED: Please use Octokit.blob instead.'
31
- get("/api/v2/json/blob/show/#{Repository.new(repo)}/#{sha}", options, 2, true, true).body
59
+ # Create a blob
60
+ #
61
+ # @param repo [String, Hash, Repository] A GitHub repository
62
+ # @param content [String] Content of the blob
63
+ # @param encoding [String] The content's encoding. <tt>utf-8</tt> and <tt>base64</tt> are accepted. If your data cannot be losslessly sent as a UTF-8 string, you can base64 encode it
64
+ # @return [String] The new blob's SHA, e.g. <tt>827efc6d56897b048c772eb4087f854f46256132</tt>
65
+ # @see http://developer.github.com/v3/git/blobs/
66
+ # @example Create a blob containing <tt>foo bar baz</tt>
67
+ # Octokit.create_blob("octocat/Hello-World", "foo bar baz")
68
+ # @example Create a blob containing <tt>foo bar baz</tt>, encoded using base64
69
+ # require "base64"
70
+ # Octokit.create_blob("octocat/Hello-World", Base64.encode64("foo bar baz"), "base64")
71
+ def create_blob(repo, content, encoding="utf-8", options={})
72
+ parameters = {
73
+ :content => content,
74
+ :encoding => encoding
75
+ }
76
+ post("/repos/#{Repository.new(repo)}/git/blobs", options.merge(parameters), 3).sha
32
77
  end
33
78
  end
34
79
  end
@@ -23,12 +23,7 @@ module Octokit
23
23
  alias :orgs :organizations
24
24
 
25
25
  def organization_repositories(org=nil, options={})
26
- if org.nil?
27
- warn 'DEPRECATED: Please pass org name to list repos.'
28
- get("/api/v2/json/organizations/repositories", options, 2)
29
- else
30
- get("orgs/#{org}/repos", options, 3)
31
- end
26
+ get("orgs/#{org}/repos", options, 3)
32
27
  end
33
28
  alias :org_repositories :organization_repositories
34
29
  alias :org_repos :organization_repositories
@@ -90,11 +90,6 @@ module Octokit
90
90
  end
91
91
  alias :remove_collab :remove_collaborator
92
92
 
93
- def pushable(options={})
94
- # There isn't a matching method in V3 of the api
95
- get("/api/v2/json/repos/pushable", options, 2)['repositories']
96
- end
97
-
98
93
  def repository_teams(repo, options={})
99
94
  get "/repos/#{Repository.new repo}/teams", options, 3
100
95
  end
@@ -2,14 +2,8 @@ module Octokit
2
2
  class Client
3
3
  module Users
4
4
 
5
- EMAIL_RE = /[\w.!#\$%+-]+@[\w-]+(?:\.[\w-]+)+/
6
5
  def search_users(search, options={})
7
- if search.match(EMAIL_RE)
8
- warn 'DEPRECATED: V3 of the API does not allow searching users by email'
9
- get("/api/v2/json/user/email/#{search}", options, 2)['user']
10
- else
11
- get("/legacy/user/search/#{search}", options, 3)['users']
12
- end
6
+ get("/legacy/user/search/#{search}", options, 3)['users']
13
7
  end
14
8
 
15
9
  # Get a single user
@@ -1,3 +1,3 @@
1
1
  module Octokit
2
- VERSION = "1.4.0" unless defined?(Octokit::VERSION)
2
+ VERSION = "1.5.0" unless defined?(Octokit::VERSION)
3
3
  end
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ {
2
+ "sha": "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15"
3
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "sha": "7638417db6d59f3c431d3e1f261cc637155684cd",
3
+ "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/7638417db6d59f3c431d3e1f261cc637155684cd",
4
+ "author": {
5
+ "date": "2012-06-06T16:13:30+12:00",
6
+ "name": "Wynn Netherland",
7
+ "email": "wynn@github.com"
8
+ },
9
+ "committer": {
10
+ "date": "2012-06-06T16:13:30+12:00",
11
+ "name": "Wynn Netherland",
12
+ "email": "wynn@github.com"
13
+ },
14
+ "message": "My commit message",
15
+ "tree": {
16
+ "url": "https://api.github.com/repos/octocat/Hello-World/git/trees/827efc6d56897b048c772eb4087f854f46256132",
17
+ "sha": "827efc6d56897b048c772eb4087f854f46256132"
18
+ },
19
+ "parents": [
20
+ {
21
+ "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/7d1b31e74ee336d15cbd21741bc88a537ed063a0",
22
+ "sha": "7d1b31e74ee336d15cbd21741bc88a537ed063a0"
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "sha": "cd8274d15fa3ae2ab983129fb037999f264ba9a7",
3
+ "url": "https://api.github.com/repo/octocat/Hello-World/trees/cd8274d15fa3ae2ab983129fb037999f264ba9a7",
4
+ "tree": [
5
+ {
6
+ "path": "file.rb",
7
+ "mode": "100644",
8
+ "type": "blob",
9
+ "size": 132,
10
+ "sha": "7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b",
11
+ "url": "https://api.github.com/octocat/Hello-World/git/blobs/7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b"
12
+ }
13
+ ]
14
+ }
@@ -29,6 +29,22 @@ describe Octokit::Client::Commits do
29
29
 
30
30
  end
31
31
 
32
+ describe ".create_commit" do
33
+
34
+ it "should create a commit" do
35
+ stub_post("/repos/octocat/Hello-World/git/commits").
36
+ with(:body => { :message => "My commit message", :tree => "827efc6d56897b048c772eb4087f854f46256132", :parents => ["7d1b31e74ee336d15cbd21741bc88a537ed063a0"] },
37
+ :headers => { "Content-Type" => "application/json" }).
38
+ to_return(:body => fixture("v3/commit_create.json"))
39
+ commit = @client.create_commit("octocat/Hello-World", "My commit message", "827efc6d56897b048c772eb4087f854f46256132", "7d1b31e74ee336d15cbd21741bc88a537ed063a0")
40
+ commit.sha.should == "7638417db6d59f3c431d3e1f261cc637155684cd"
41
+ commit.message.should == "My commit message"
42
+ commit.parents.size.should == 1
43
+ commit.parents.first.sha.should == "7d1b31e74ee336d15cbd21741bc88a537ed063a0"
44
+ end
45
+
46
+ end
47
+
32
48
  describe ".list_commit_comments" do
33
49
 
34
50
  it "should return a list of all commit comments" do
@@ -11,7 +11,7 @@ describe Octokit::Client::Issues do
11
11
 
12
12
  it "should return matching issues" do
13
13
  stub_get("https://api.github.com/legacy/issues/search/sferik/rails_admin/open/activerecord").
14
- to_return(:body => fixture("v2/issues.json"))
14
+ to_return(:body => fixture("legacy/issues.json"))
15
15
  issues = @client.search_issues("sferik/rails_admin", "activerecord")
16
16
  issues.first.number.should == 105
17
17
  end
@@ -19,6 +19,21 @@ describe Octokit::Client::Objects do
19
19
 
20
20
  end
21
21
 
22
+ describe ".create_tree" do
23
+
24
+ it "should create a tree" do
25
+ stub_post("/repos/octocat/Hello-World/git/trees").
26
+ with(:body => { :tree => [ { :path => "file.rb", "mode" => "100644", "type" => "blob", "sha" => "44b4fc6d56897b048c772eb4087f854f46256132" } ] },
27
+ :headers => { "Content-Type" => "application/json" }).
28
+ to_return(:body => fixture("v3/tree_create.json"))
29
+ response = @client.create_tree("octocat/Hello-World", [ { "path" => "file.rb", "mode" => "100644", "type" => "blob", "sha" => "44b4fc6d56897b048c772eb4087f854f46256132" } ])
30
+ response.sha.should == "cd8274d15fa3ae2ab983129fb037999f264ba9a7"
31
+ response.tree.size.should == 1
32
+ response.tree.first.sha.should == "7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b"
33
+ end
34
+
35
+ end
36
+
22
37
  describe ".blob" do
23
38
 
24
39
  it "should return a blob" do
@@ -30,48 +45,15 @@ describe Octokit::Client::Objects do
30
45
 
31
46
  end
32
47
 
33
- describe ".blobs" do
34
-
35
- it "should return blobs" do
36
- stub_get("https://github.com/api/v2/json/blob/all/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
37
- to_return(:body => fixture("v2/blobs.json"))
38
- blobs = @client.blobs("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
39
- blobs[".gitignore"].should == "5efe0eb47a773fa6ea84a0bf190ee218b6a31ead"
40
- end
41
-
42
- end
43
-
44
- describe ".blob_metadata" do
45
-
46
- it "should return blob metadata" do
47
- stub_get("https://github.com/api/v2/json/blob/full/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
48
- to_return(:body => fixture("v2/blob_metadata.json"))
49
- blob_metadata = @client.blob_metadata("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
50
- blob_metadata.first.name.should == ".gitignore"
51
- end
52
-
53
- end
54
-
55
- describe ".tree_metadata" do
56
-
57
- it "should return tree metadata" do
58
- stub_get("https://github.com/api/v2/json/tree/full/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
59
- to_return(:body => fixture("v2/tree_metadata.json"))
60
- tree_metadata = @client.tree_metadata("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
61
- tree_metadata.first.name.should == ".gitignore"
62
- end
63
-
64
- end
65
-
66
- describe ".raw" do
48
+ describe ".create_blob" do
67
49
 
68
- it "should return raw data" do
69
- stub_get("https://github.com/api/v2/json/blob/show/sferik/rails_admin/3cdfabd973bc3caac209cba903cfdb3bf6636bcd").
70
- to_return(:body => fixture("v2/raw.txt"))
71
- raw = @client.raw("sferik/rails_admin", "3cdfabd973bc3caac209cba903cfdb3bf6636bcd")
72
- lambda {
73
- MultiJson.load(raw)
74
- }.should raise_error
50
+ it "should create a blob" do
51
+ stub_post("/repos/octocat/Hello-World/git/blobs").
52
+ with(:body => { :content => "content", :encoding => "utf-8" },
53
+ :headers => { "Content-Type" => "application/json" }).
54
+ to_return(:body => fixture("v3/blob_create.json"))
55
+ blob = @client.create_blob("octocat/Hello-World", "content")
56
+ blob.should == "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15"
75
57
  end
76
58
 
77
59
  end
@@ -58,26 +58,11 @@ describe Octokit::Client::Organizations do
58
58
 
59
59
  describe ".organization_repositories" do
60
60
 
61
- context "with an org passed" do
62
-
63
- it "should return all public repositories for an organization" do
64
- stub_get("https://api.github.com/orgs/codeforamerica/repos").
65
- to_return(:body => fixture("v3/organization-repositories.json"))
66
- repositories = @client.organization_repositories("codeforamerica")
67
- repositories.first.name.should == "cfahelloworld"
68
- end
69
-
70
- end
71
-
72
- context "without an org passed" do
73
-
74
- it "should return all organization repositories for a user" do
75
- stub_get("https://github.com/api/v2/json/organizations/repositories").
76
- to_return(:body => fixture("v2/repositories.json"))
77
- repositories = @client.organization_repositories
78
- repositories.repositories.first.name.should == "One40Proof"
79
- end
80
-
61
+ it "should return all public repositories for an organization" do
62
+ stub_get("https://api.github.com/orgs/codeforamerica/repos").
63
+ to_return(:body => fixture("v3/organization-repositories.json"))
64
+ repositories = @client.organization_repositories("codeforamerica")
65
+ repositories.first.name.should == "cfahelloworld"
81
66
  end
82
67
 
83
68
  end