github_api 0.2.0 → 0.2.1
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.
- data/README.rdoc +51 -20
- data/lib/github_api.rb +3 -1
- data/lib/github_api/api.rb +8 -2
- data/lib/github_api/authorization.rb +52 -0
- data/lib/github_api/cache_control.rb +19 -0
- data/lib/github_api/configuration.rb +8 -11
- data/lib/github_api/connection.rb +18 -36
- data/lib/github_api/gists/comments.rb +17 -5
- data/lib/github_api/issues.rb +9 -1
- data/lib/github_api/issues/comments.rb +15 -4
- data/lib/github_api/mime_type.rb +55 -0
- data/lib/github_api/pull_requests.rb +14 -0
- data/lib/github_api/pull_requests/comments.rb +10 -0
- data/lib/github_api/repos/collaborators.rb +41 -19
- data/lib/github_api/repos/commits.rb +108 -43
- data/lib/github_api/repos/forks.rb +32 -13
- data/lib/github_api/request.rb +12 -3
- data/lib/github_api/request/caching.rb +33 -0
- data/lib/github_api/version.rb +1 -1
- data/spec/fixtures/repos/collaborators.json +8 -0
- data/spec/fixtures/repos/commit.json +53 -0
- data/spec/fixtures/repos/commit_comment.json +16 -0
- data/spec/fixtures/repos/commit_comments.json +18 -0
- data/spec/fixtures/repos/commits.json +27 -0
- data/spec/fixtures/{repos_list.json → repos/fork.json} +0 -0
- data/spec/fixtures/repos/forks.json +29 -0
- data/spec/fixtures/repos/repo_comments.json +18 -0
- data/spec/github/authorization_spec.rb +71 -0
- data/spec/github/mime_type_spec.rb +70 -0
- data/spec/github/repos/collaborators_spec.rb +166 -3
- data/spec/github/repos/commits_spec.rb +421 -2
- data/spec/github/repos/forks_spec.rb +101 -3
- data/spec/github/repos/watching_spec.rb +6 -0
- data/spec/github_spec.rb +8 -4
- metadata +17 -9
- data/lib/github_api/api/extract_options.rb +0 -17
- data/lib/github_api/api/mime.rb +0 -5
- data/spec/fixtures/collaborators_list.json +0 -6
- data/spec/fixtures/commits_list.json +0 -25
- data/spec/fixtures/repos_branches_list.json +0 -7
|
@@ -3,27 +3,46 @@
|
|
|
3
3
|
module Github
|
|
4
4
|
class Repos
|
|
5
5
|
module Forks
|
|
6
|
-
|
|
7
|
-
# List forks
|
|
8
|
-
#
|
|
9
|
-
# GET /repos/:user/:repo/forks
|
|
6
|
+
|
|
7
|
+
# List repository forks
|
|
10
8
|
#
|
|
11
|
-
# Examples
|
|
9
|
+
# = Examples
|
|
10
|
+
# @github = Github.new
|
|
11
|
+
# @github.repos.forks 'user-name', 'repo-name'
|
|
12
|
+
# @github.repos.forks 'user-name', 'repo-name' { |hook| ... }
|
|
12
13
|
#
|
|
13
|
-
def forks(
|
|
14
|
-
|
|
14
|
+
def forks(user_name=nil, repo_name=nil, params = {})
|
|
15
|
+
_update_user_repo_params(user_name, repo_name)
|
|
16
|
+
_validate_user_repo_params(user, repo) unless user? && repo?
|
|
17
|
+
_normalize_params_keys(params)
|
|
18
|
+
|
|
19
|
+
response = get("/repos/#{user}/#{repo}/forks")
|
|
20
|
+
return response unless block_given?
|
|
21
|
+
response.each { |el| yield el }
|
|
15
22
|
end
|
|
16
|
-
|
|
23
|
+
alias :repo_forks :forks
|
|
24
|
+
alias :repository_forks :forks
|
|
25
|
+
|
|
17
26
|
# Create a fork for the authenticated user
|
|
18
|
-
#
|
|
19
|
-
# POST /repos/:user/:repo/forks
|
|
20
27
|
#
|
|
21
|
-
|
|
28
|
+
# = Inputs
|
|
29
|
+
# * <tt>:org</tt> - Optional string - the name of the service that is being called.
|
|
30
|
+
#
|
|
31
|
+
# = Examples
|
|
32
|
+
# @github = Github.new
|
|
33
|
+
# @github.repos.create_fork 'user-name', 'repo-name',
|
|
34
|
+
# "org" => "github"
|
|
35
|
+
#
|
|
36
|
+
def create_fork(user_name=nil, repo_name=nil, params={})
|
|
37
|
+
_update_user_repo_params(user_name, repo_name)
|
|
38
|
+
_validate_user_repo_params(user, repo) unless user? && repo?
|
|
39
|
+
|
|
22
40
|
_normalize_params_keys(params)
|
|
23
41
|
_filter_params_keys(%w[ org ], params)
|
|
24
42
|
|
|
25
43
|
post("/repos/#{user}/#{repo}/forks", params)
|
|
26
44
|
end
|
|
27
|
-
|
|
28
|
-
|
|
45
|
+
|
|
46
|
+
end # Forks
|
|
47
|
+
end # Repos
|
|
29
48
|
end # Github
|
data/lib/github_api/request.rb
CHANGED
|
@@ -7,7 +7,7 @@ require 'set'
|
|
|
7
7
|
module Github
|
|
8
8
|
# Defines HTTP verbs
|
|
9
9
|
module Request
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
METHODS = [:get, :post, :put, :delete, :patch]
|
|
12
12
|
METHODS_WITH_BODIES = [ :post, :put, :patch ]
|
|
13
13
|
|
|
@@ -39,6 +39,7 @@ module Github
|
|
|
39
39
|
if !METHODS.include?(method)
|
|
40
40
|
raise ArgumentError, "unkown http method: #{method}"
|
|
41
41
|
end
|
|
42
|
+
_extract_mime_type(params, options)
|
|
42
43
|
|
|
43
44
|
puts "EXECUTED: #{method} - #{path} with #{params} and #{options}"
|
|
44
45
|
|
|
@@ -54,16 +55,24 @@ module Github
|
|
|
54
55
|
response.body
|
|
55
56
|
end
|
|
56
57
|
|
|
57
|
-
|
|
58
|
+
private
|
|
59
|
+
|
|
60
|
+
def _process_params(params) # :nodoc:
|
|
58
61
|
return params['data'] if params.has_key?('data')
|
|
59
62
|
return params
|
|
60
63
|
end
|
|
64
|
+
|
|
65
|
+
def _extract_mime_type(params, options) # :nodoc:
|
|
66
|
+
options['resource'] = params.delete('resource') || ''
|
|
67
|
+
options['mime_type'] = params.delete('mime_type')
|
|
68
|
+
end
|
|
69
|
+
|
|
61
70
|
# no need for this smizzle
|
|
62
71
|
def formatted_path(path, options={})
|
|
63
72
|
[ path, options.fetch(:format, format) ].compact.join('.')
|
|
64
73
|
end
|
|
65
74
|
|
|
66
|
-
def basic_auth(login, password)
|
|
75
|
+
def basic_auth(login, password) # :nodoc:
|
|
67
76
|
auth = Base64.encode("#{login}:#{password}")
|
|
68
77
|
auth.gsub!("\n", "")
|
|
69
78
|
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
require 'faraday'
|
|
4
|
+
|
|
5
|
+
module Github
|
|
6
|
+
module Request
|
|
7
|
+
class Caching < Faraday::Middleware
|
|
8
|
+
attr_reader :cache
|
|
9
|
+
|
|
10
|
+
def initialize(app, cache = nil, options={})
|
|
11
|
+
super(app)
|
|
12
|
+
@cache = cache || Proc.new{}.call
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def call(env)
|
|
16
|
+
if env[:method] == :get
|
|
17
|
+
# TODO choose cache method
|
|
18
|
+
# file_store
|
|
19
|
+
# mem_cache_store
|
|
20
|
+
# memory_store
|
|
21
|
+
else
|
|
22
|
+
@app.call(env)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def cache_key
|
|
27
|
+
url = env[:url].dup
|
|
28
|
+
if url.query
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end # Request
|
|
33
|
+
end # Github
|
data/lib/github_api/version.rb
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
|
3
|
+
"commit": {
|
|
4
|
+
"url": "https://api.github.com/repos/octocat/Hello-World/git/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
|
5
|
+
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Monalisa Octocat",
|
|
8
|
+
"email": "support@github.com",
|
|
9
|
+
"date": "2011-04-14T16:00:49Z"
|
|
10
|
+
},
|
|
11
|
+
"committer": {
|
|
12
|
+
"name": "Monalisa Octocat",
|
|
13
|
+
"email": "support@github.com",
|
|
14
|
+
"date": "2011-04-14T16:00:49Z"
|
|
15
|
+
},
|
|
16
|
+
"message": "Fix all the bugs",
|
|
17
|
+
"tree": {
|
|
18
|
+
"url": "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
|
19
|
+
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"author": {
|
|
23
|
+
"login": "octocat",
|
|
24
|
+
"id": 1,
|
|
25
|
+
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
|
26
|
+
"url": "https://api.github.com/users/octocat"
|
|
27
|
+
},
|
|
28
|
+
"committer": {
|
|
29
|
+
"login": "octocat",
|
|
30
|
+
"id": 1,
|
|
31
|
+
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
|
32
|
+
"url": "https://api.github.com/users/octocat"
|
|
33
|
+
},
|
|
34
|
+
"parents": [
|
|
35
|
+
{
|
|
36
|
+
"url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
|
37
|
+
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"stats": {
|
|
41
|
+
"additions": 104,
|
|
42
|
+
"deletions": 4,
|
|
43
|
+
"total": 108
|
|
44
|
+
},
|
|
45
|
+
"files": [
|
|
46
|
+
{
|
|
47
|
+
"filename": "file1.txt",
|
|
48
|
+
"additions": 10,
|
|
49
|
+
"deletions": 2,
|
|
50
|
+
"total": 12
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1",
|
|
3
|
+
"id": 1,
|
|
4
|
+
"body": "Great stuff",
|
|
5
|
+
"path": "file1.txt",
|
|
6
|
+
"position": 4,
|
|
7
|
+
"commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
|
8
|
+
"user": {
|
|
9
|
+
"login": "octocat",
|
|
10
|
+
"id": 1,
|
|
11
|
+
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
|
12
|
+
"url": "https://api.github.com/users/octocat"
|
|
13
|
+
},
|
|
14
|
+
"created_at": "2011-04-14T16:00:49Z",
|
|
15
|
+
"updated_at": "2011-04-14T16:00:49Z"
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1",
|
|
4
|
+
"id": 1,
|
|
5
|
+
"body": "Great stuff",
|
|
6
|
+
"path": "file1.txt",
|
|
7
|
+
"position": 4,
|
|
8
|
+
"commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
|
9
|
+
"user": {
|
|
10
|
+
"login": "octocat",
|
|
11
|
+
"id": 1,
|
|
12
|
+
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
|
13
|
+
"url": "https://api.github.com/users/octocat"
|
|
14
|
+
},
|
|
15
|
+
"created_at": "2011-04-14T16:00:49Z",
|
|
16
|
+
"updated_at": "2011-04-14T16:00:49Z"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"sha": "7638417db6d59f3c431d3e1f261cc637155684cd",
|
|
4
|
+
"url": "https://api.github.com/repos/octocat/Hello-World/git/commits/7638417db6d59f3c431d3e1f261cc637155684cd",
|
|
5
|
+
"author": {
|
|
6
|
+
"date": "2010-04-10T14:10:01-07:00",
|
|
7
|
+
"name": "Scott Chacon",
|
|
8
|
+
"email": "schacon@gmail.com"
|
|
9
|
+
},
|
|
10
|
+
"committer": {
|
|
11
|
+
"date": "2010-04-10T14:10:01-07:00",
|
|
12
|
+
"name": "Scott Chacon",
|
|
13
|
+
"email": "schacon@gmail.com"
|
|
14
|
+
},
|
|
15
|
+
"message": "added readme, because im a good github citizen\n",
|
|
16
|
+
"tree": {
|
|
17
|
+
"url": "https://api.github.com/repos/octocat/Hello-World/git/trees/691272480426f78a0138979dd3ce63b77f706feb",
|
|
18
|
+
"sha": "691272480426f78a0138979dd3ce63b77f706feb"
|
|
19
|
+
},
|
|
20
|
+
"parents": [
|
|
21
|
+
{
|
|
22
|
+
"url": "https://api.github.com/repos/octocat/Hello-World/git/commits/1acc419d4d6a9ce985db7be48c6349a0475975b5",
|
|
23
|
+
"sha": "1acc419d4d6a9ce985db7be48c6349a0475975b5"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"url": "https://api.github.com/repos/octocat/Hello-World",
|
|
4
|
+
"html_url": "https://github.com/octocat/Hello-World",
|
|
5
|
+
"clone_url": "https://github.com/octocat/Hello-World.git",
|
|
6
|
+
"git_url": "git://github.com/octocat/Hello-World.git",
|
|
7
|
+
"ssh_url": "git@github.com:octocat/Hello-World.git",
|
|
8
|
+
"svn_url": "https://svn.github.com/octocat/Hello-World",
|
|
9
|
+
"owner": {
|
|
10
|
+
"login": "octocat",
|
|
11
|
+
"id": 1,
|
|
12
|
+
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
|
13
|
+
"url": "https://api.github.com/users/octocat"
|
|
14
|
+
},
|
|
15
|
+
"name": "Hello-World",
|
|
16
|
+
"description": "This your first repo!",
|
|
17
|
+
"homepage": "https://github.com",
|
|
18
|
+
"language": null,
|
|
19
|
+
"private": false,
|
|
20
|
+
"fork": false,
|
|
21
|
+
"forks": 9,
|
|
22
|
+
"watchers": 80,
|
|
23
|
+
"size": 108,
|
|
24
|
+
"master_branch": "master",
|
|
25
|
+
"open_issues": 0,
|
|
26
|
+
"pushed_at": "2011-01-26T19:06:43Z",
|
|
27
|
+
"created_at": "2011-01-26T19:01:12Z"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1",
|
|
4
|
+
"id": 1,
|
|
5
|
+
"body": "Great stuff",
|
|
6
|
+
"path": "file1.txt",
|
|
7
|
+
"position": 4,
|
|
8
|
+
"commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
|
9
|
+
"user": {
|
|
10
|
+
"login": "octocat",
|
|
11
|
+
"id": 1,
|
|
12
|
+
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
|
13
|
+
"url": "https://api.github.com/users/octocat"
|
|
14
|
+
},
|
|
15
|
+
"created_at": "2011-04-14T16:00:49Z",
|
|
16
|
+
"updated_at": "2011-04-14T16:00:49Z"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Github::Authorization do
|
|
4
|
+
|
|
5
|
+
let(:client_id) { '234jl23j4l23j4l' }
|
|
6
|
+
let(:client_secret) { 'asasd79sdf9a7asfd7sfd97s' }
|
|
7
|
+
let(:code) { 'c9798sdf97df98ds'}
|
|
8
|
+
let(:github) { Github.new }
|
|
9
|
+
|
|
10
|
+
it "should instantiate oauth2 instance" do
|
|
11
|
+
github.client.should be_a OAuth2::Client
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "should assign site from the options hash" do
|
|
15
|
+
github.client.site.should == 'https://github.com'
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it "should assign 'authorize_url" do
|
|
19
|
+
github.client.authorize_url.should == 'https://github.com/login/oauth/authorize'
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "should assign 'token_url" do
|
|
23
|
+
github.client.token_url.should == 'https://github.com/login/oauth/access_token'
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
context "authorize_url" do
|
|
27
|
+
before do
|
|
28
|
+
github = Github.new :client_id => client_id, :client_secret => client_secret
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it "should respond to 'authorize_url' " do
|
|
32
|
+
github.should respond_to :authorize_url
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it "should return address containing client_id" do
|
|
36
|
+
github.authorize_url.should =~ /client_id=#{client_id}/
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it "should return address containing scopes" do
|
|
40
|
+
github.authorize_url(:scope => 'user').should =~ /scope=user/
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it "should return address containing redirect_uri" do
|
|
44
|
+
github.authorize_url(:redirect_uri => 'http://localhost').should =~ /redirect_uri/
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
context "get_token" do
|
|
49
|
+
before do
|
|
50
|
+
github = Github.new :client_id => client_id, :client_secret => client_secret
|
|
51
|
+
stub_request(:post, 'https://github.com/login/oauth/access_token').
|
|
52
|
+
to_return(:body => '', :status => 200, :headers => {})
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it "should respond to 'get_token' " do
|
|
56
|
+
github.should respond_to :get_token
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it "should make the authorization request" do
|
|
60
|
+
expect {
|
|
61
|
+
github.get_token code
|
|
62
|
+
a_request(:post, "https://github.com/login/oauth/access_token").should have_been_made
|
|
63
|
+
}.to raise_error(OAuth2::Error)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it "should fail to get_token without authorization code" do
|
|
67
|
+
expect { github.get_token }.to raise_error(ArgumentError)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
end # Github::Authorization
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Github::MimeType do
|
|
4
|
+
|
|
5
|
+
let(:github) { Github.new }
|
|
6
|
+
|
|
7
|
+
it "should lookup mime type for :full" do
|
|
8
|
+
github.lookup_mime(:full).should == 'full+json'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "should lookup mime type for :html" do
|
|
12
|
+
github.lookup_mime(:html).should == 'html+json'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it "should lookup mime type for :html" do
|
|
16
|
+
github.lookup_mime(:text).should == 'text+json'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "should lookup mime type for :raw" do
|
|
20
|
+
github.lookup_mime(:raw).should == 'raw+json'
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it "should default to json if no parameters given" do
|
|
24
|
+
Github.should_receive(:parse).and_return 'application/json'
|
|
25
|
+
Github.parse.should == 'application/json'
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it "should accept header for 'issue' request" do
|
|
29
|
+
Github.should_receive(:parse).with(:issue, :full).
|
|
30
|
+
and_return 'application/vnd.github-issue.full+json'
|
|
31
|
+
Github.parse(:issue, :full).should == 'application/vnd.github-issue.full+json'
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "should accept header for 'isssue comment' request" do
|
|
35
|
+
Github.should_receive(:parse).with(:issue_comment, :full).
|
|
36
|
+
and_return 'application/vnd.github-issuecomment.full+json'
|
|
37
|
+
Github.parse(:issue_comment, :full).should == 'application/vnd.github-issuecomment.full+json'
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it "should accept header for 'commit comment' request" do
|
|
41
|
+
Github.should_receive(:parse).with(:commit_comment, :full).
|
|
42
|
+
and_return 'application/vnd.github-commitcomment.full+json'
|
|
43
|
+
Github.parse(:commit_comment, :full).should == 'application/vnd.github-commitcomment.full+json'
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it "should accept header for 'pull requst' request" do
|
|
47
|
+
Github.should_receive(:parse).with(:pull_request, :full).
|
|
48
|
+
and_return 'application/vnd.github-pull.full+json'
|
|
49
|
+
Github.parse(:pull_request, :full).should == 'application/vnd.github-pull.full+json'
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it "should accept header for 'pull comment' request" do
|
|
53
|
+
Github.should_receive(:parse).with(:pull_comment, :full).
|
|
54
|
+
and_return 'application/vnd.github-pullcomment.full+json'
|
|
55
|
+
Github.parse(:pull_comment, :full).should == 'application/vnd.github-pullcomment.full+json'
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it "should accept header for 'gist comment' request" do
|
|
59
|
+
Github.should_receive(:parse).with(:gist_comment, :full).
|
|
60
|
+
and_return 'application/vnd.github-gistcomment.full+json'
|
|
61
|
+
Github.parse(:gist_comment, :full).should == 'application/vnd.github-gistcomment.full+json'
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it "should accept header for 'blog' request" do
|
|
65
|
+
Github.should_receive(:parse).with(:blob, :blob).
|
|
66
|
+
and_return 'application/vnd.github-blob.raw'
|
|
67
|
+
Github.parse(:blob, :blob).should == 'application/vnd.github-blob.raw'
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
end # Github::MimeType
|