github_api 0.4.11 → 0.5.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/README.md +76 -72
  2. data/features/cassettes/gists/starred.yml +48 -0
  3. data/features/cassettes/pagination/repos/commits/list.yml +193 -0
  4. data/features/cassettes/pagination/repos/commits/next.yml +183 -0
  5. data/features/cassettes/pagination/repos/diff/next.yml +45 -0
  6. data/features/cassettes/pagination/repos/list.yml +176 -0
  7. data/features/cassettes/pagination/repos/list/next.yml +222 -0
  8. data/features/cassettes/pagination/repos/per_page/each_page.yml +45 -0
  9. data/features/cassettes/repos/list.yml +92 -0
  10. data/features/error_codes.feature +1 -1
  11. data/features/gists.feature +12 -3
  12. data/features/gists/comments.feature +3 -3
  13. data/features/github_api.feature +13 -2
  14. data/features/pagination.feature +40 -39
  15. data/features/repos.feature +2 -2
  16. data/features/step_definitions/common_steps.rb +12 -0
  17. data/features/step_definitions/github_api_steps.rb +12 -1
  18. data/lib/github_api.rb +1 -1
  19. data/lib/github_api/api.rb +4 -2
  20. data/lib/github_api/api_factory.rb +11 -5
  21. data/lib/github_api/authorizations.rb +23 -32
  22. data/lib/github_api/client.rb +1 -0
  23. data/lib/github_api/events.rb +38 -38
  24. data/lib/github_api/filter.rb +1 -1
  25. data/lib/github_api/gists.rb +47 -42
  26. data/lib/github_api/gists/comments.rb +77 -84
  27. data/lib/github_api/git_data.rb +25 -6
  28. data/lib/github_api/git_data/blobs.rb +48 -45
  29. data/lib/github_api/git_data/commits.rb +76 -73
  30. data/lib/github_api/git_data/references.rb +137 -118
  31. data/lib/github_api/git_data/tags.rb +74 -70
  32. data/lib/github_api/git_data/trees.rb +88 -85
  33. data/lib/github_api/issues.rb +43 -31
  34. data/lib/github_api/issues/comments.rb +116 -119
  35. data/lib/github_api/issues/events.rb +20 -19
  36. data/lib/github_api/issues/labels.rb +200 -197
  37. data/lib/github_api/issues/milestones.rb +137 -134
  38. data/lib/github_api/orgs.rb +27 -23
  39. data/lib/github_api/orgs/members.rb +105 -108
  40. data/lib/github_api/orgs/teams.rb +236 -237
  41. data/lib/github_api/paged_request.rb +1 -1
  42. data/lib/github_api/pull_requests.rb +40 -42
  43. data/lib/github_api/pull_requests/comments.rb +140 -143
  44. data/lib/github_api/repos.rb +101 -67
  45. data/lib/github_api/repos/collaborators.rb +64 -68
  46. data/lib/github_api/repos/commits.rb +50 -39
  47. data/lib/github_api/repos/downloads.rb +107 -110
  48. data/lib/github_api/repos/forks.rb +38 -39
  49. data/lib/github_api/repos/hooks.rb +161 -167
  50. data/lib/github_api/repos/keys.rb +86 -86
  51. data/lib/github_api/repos/pub_sub_hubbub.rb +99 -87
  52. data/lib/github_api/repos/watching.rb +80 -82
  53. data/lib/github_api/request.rb +5 -9
  54. data/lib/github_api/users.rb +26 -16
  55. data/lib/github_api/users/emails.rb +47 -47
  56. data/lib/github_api/users/followers.rb +85 -86
  57. data/lib/github_api/users/keys.rb +73 -75
  58. data/lib/github_api/validations.rb +25 -0
  59. data/lib/github_api/validations/format.rb +23 -0
  60. data/lib/github_api/validations/presence.rb +25 -0
  61. data/lib/github_api/validations/required.rb +21 -0
  62. data/lib/github_api/validations/token.rb +41 -0
  63. data/lib/github_api/version.rb +3 -3
  64. data/spec/fixtures/repos/commit_comparison.json +112 -0
  65. data/spec/github/api_factory_spec.rb +17 -1
  66. data/spec/github/authorizations_spec.rb +36 -34
  67. data/spec/github/gists/comments_spec.rb +39 -45
  68. data/spec/github/gists_spec.rb +50 -53
  69. data/spec/github/git_data/blobs_spec.rb +27 -20
  70. data/spec/github/git_data/commits_spec.rb +20 -19
  71. data/spec/github/git_data/references_spec.rb +83 -46
  72. data/spec/github/git_data/tags_spec.rb +16 -15
  73. data/spec/github/git_data/trees_spec.rb +20 -19
  74. data/spec/github/git_data_spec.rb +10 -1
  75. data/spec/github/issues/comments_spec.rb +78 -68
  76. data/spec/github/issues/events_spec.rb +42 -34
  77. data/spec/github/issues/labels_spec.rb +89 -101
  78. data/spec/github/issues/milestones_spec.rb +76 -54
  79. data/spec/github/issues_spec.rb +53 -57
  80. data/spec/github/orgs/members_spec.rb +64 -49
  81. data/spec/github/orgs/teams_spec.rb +112 -101
  82. data/spec/github/orgs_spec.rb +41 -31
  83. data/spec/github/paged_request_spec.rb +6 -5
  84. data/spec/github/pull_requests/comments_spec.rb +39 -44
  85. data/spec/github/pull_requests_spec.rb +32 -48
  86. data/spec/github/repos/collaborators_spec.rb +40 -29
  87. data/spec/github/repos/commits_spec.rb +108 -64
  88. data/spec/github/repos/downloads_spec.rb +46 -45
  89. data/spec/github/repos/forks_spec.rb +23 -24
  90. data/spec/github/repos/hooks_spec.rb +69 -71
  91. data/spec/github/repos/keys_spec.rb +39 -34
  92. data/spec/github/repos/pub_sub_hubbub_spec.rb +4 -4
  93. data/spec/github/repos/watching_spec.rb +31 -33
  94. data/spec/github/repos_spec.rb +74 -83
  95. data/spec/github/request_spec.rb +31 -2
  96. data/spec/github/users/emails_spec.rb +19 -17
  97. data/spec/github/users/followers_spec.rb +30 -28
  98. data/spec/github/users/keys_spec.rb +37 -33
  99. data/spec/github/users_spec.rb +124 -125
  100. data/spec/github/validations/format_spec.rb +42 -0
  101. data/spec/github/validations/presence_spec.rb +18 -0
  102. data/spec/github/validations/required_spec.rb +28 -0
  103. data/spec/github/validations/token_spec.rb +19 -0
  104. data/spec/github/validations_spec.rb +23 -0
  105. metadata +33 -10
  106. data/features/cassettes/pagination/repos.yml +0 -177
  107. data/features/cassettes/pagination/repos/next.yml +0 -177
  108. data/lib/github_api/validation.rb +0 -53
  109. data/spec/github/validation_spec.rb +0 -62
@@ -0,0 +1,23 @@
1
+ # encoding: utf-8
2
+
3
+ module Github
4
+ module Validations
5
+ module Format
6
+
7
+ # Ensures that value for a given key is of the correct form whether
8
+ # matching regular expression or set of predefined values.
9
+ #
10
+ def _validate_params_values(permitted, params)
11
+ params.each do |k, v|
12
+ next unless permitted.keys.include?(k)
13
+ if permitted[k].is_a?(Array) && !permitted[k].include?(params[k])
14
+ raise ArgumentError, "Wrong value for #{k}, allowed: #{permitted[k].join(', ')}"
15
+ elsif permitted[k].is_a?(Regexp) && !(permitted[k] =~ params[k])
16
+ raise ArgumentError, "String does not match the parameter value."
17
+ end
18
+ end
19
+ end
20
+
21
+ end # Format
22
+ end # Validations
23
+ end # Github
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+
3
+ module Github
4
+ module Validations
5
+ module Presence
6
+
7
+ # Ensures that esential arguments are present before request is made
8
+ #
9
+ def _validate_presence_of(*params)
10
+ params.each do |param|
11
+ raise ArgumentError, "parameter cannot be nil" if param.nil?
12
+ end
13
+ end
14
+
15
+
16
+ # Check if user or repository parameters are passed
17
+ #
18
+ def _validate_user_repo_params(user_name, repo_name)
19
+ raise ArgumentError, "[user] parameter cannot be nil" if user_name.nil?
20
+ raise ArgumentError, "[repo] parameter cannot be nil" if repo_name.nil?
21
+ end
22
+
23
+ end # Presence
24
+ end # Validations
25
+ end # Github
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+
3
+ module Github
4
+ module Validations
5
+ module Required
6
+
7
+ # Ensures that esential input parameters are present before request is made.
8
+ #
9
+ def _validate_inputs(required, provided)
10
+ result = required.all? do |key|
11
+ provided.has_deep_key? key
12
+ end
13
+ if !result
14
+ raise Github::Error::RequiredParams.new(provided, required)
15
+ end
16
+ result
17
+ end
18
+
19
+ end # Required
20
+ end # Validations
21
+ end # Github
@@ -0,0 +1,41 @@
1
+ # encoding: utf-8
2
+
3
+ module Github
4
+ module Validations
5
+ module Token
6
+
7
+ TOKEN_REQUIRED = [
8
+ 'get /user',
9
+ 'get /user/emails',
10
+ 'get /user/followers',
11
+ 'get /user/following',
12
+ 'get /user/keys',
13
+ 'get /user/repos',
14
+ 'patch /user',
15
+ 'post /user/emails',
16
+ 'post /user/keys',
17
+ 'post /user/repos'
18
+ ]
19
+
20
+ TOKEN_REQUIRED_REGEXP = [
21
+ /repos\/.*\/.*\/comments/,
22
+ ]
23
+
24
+ # Ensures that required authentication token is present before
25
+ # request is sent.
26
+ #
27
+ def validates_token_for(method, path)
28
+ return true unless TOKEN_REQUIRED.grep("#{method} #{path}").empty?
29
+
30
+ token_required = false
31
+ TOKEN_REQUIRED_REGEXP.each do |regex|
32
+ if "#{method} #{path}" =~ regex
33
+ token_required = true
34
+ end
35
+ end
36
+ return token_required
37
+ end
38
+
39
+ end # Token
40
+ end # Validations
41
+ end # Github
@@ -3,9 +3,9 @@
3
3
  module Github
4
4
  module VERSION
5
5
  MAJOR = 0
6
- MINOR = 4
7
- PATCH = 11
8
- BUILD = nil
6
+ MINOR = 5
7
+ PATCH = 0
8
+ BUILD = 'rc1'
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.');
11
11
  end
@@ -0,0 +1,112 @@
1
+ {
2
+ "url": "https://api.github.com/repos/octocat/Hello-World/compare/master...topic",
3
+ "html_url": "https://github.com/octocat/Hello-World/compare/master...topic",
4
+ "permalink_url": "https://github.com/octocat/Hello-World/compare/octocat:bbcd538c8e72b8c175046e27cc8f907076331401...octocat:0328041d1152db8ae77652d1618a02e57f745f17",
5
+ "diff_url": "https://github.com/octocat/Hello-World/compare/master...topic.diff",
6
+ "patch_url": "https://github.com/octocat/Hello-World/compare/master...topic.patch",
7
+ "base_commit": {
8
+ "url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
9
+ "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
10
+ "commit": {
11
+ "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
12
+ "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
13
+ "author": {
14
+ "name": "Monalisa Octocat",
15
+ "email": "support@github.com",
16
+ "date": "2011-04-14T16:00:49Z"
17
+ },
18
+ "committer": {
19
+ "name": "Monalisa Octocat",
20
+ "email": "support@github.com",
21
+ "date": "2011-04-14T16:00:49Z"
22
+ },
23
+ "message": "Fix all the bugs",
24
+ "tree": {
25
+ "url": "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e",
26
+ "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
27
+ }
28
+ },
29
+ "author": {
30
+ "login": "octocat",
31
+ "id": 1,
32
+ "avatar_url": "https://github.com/images/error/octocat_happy.gif",
33
+ "gravatar_id": "somehexcode",
34
+ "url": "https://api.github.com/users/octocat"
35
+ },
36
+ "committer": {
37
+ "login": "octocat",
38
+ "id": 1,
39
+ "avatar_url": "https://github.com/images/error/octocat_happy.gif",
40
+ "gravatar_id": "somehexcode",
41
+ "url": "https://api.github.com/users/octocat"
42
+ },
43
+ "parents": [
44
+ {
45
+ "url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
46
+ "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
47
+ }
48
+ ]
49
+ },
50
+ "status": "behind",
51
+ "ahead_by": 1,
52
+ "behind_by": 2,
53
+ "total_commits": 1,
54
+ "commits": [
55
+ {
56
+ "url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
57
+ "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
58
+ "commit": {
59
+ "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
60
+ "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
61
+ "author": {
62
+ "name": "Monalisa Octocat",
63
+ "email": "support@github.com",
64
+ "date": "2011-04-14T16:00:49Z"
65
+ },
66
+ "committer": {
67
+ "name": "Monalisa Octocat",
68
+ "email": "support@github.com",
69
+ "date": "2011-04-14T16:00:49Z"
70
+ },
71
+ "message": "Fix all the bugs",
72
+ "tree": {
73
+ "url": "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e",
74
+ "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
75
+ }
76
+ },
77
+ "author": {
78
+ "login": "octocat",
79
+ "id": 1,
80
+ "avatar_url": "https://github.com/images/error/octocat_happy.gif",
81
+ "gravatar_id": "somehexcode",
82
+ "url": "https://api.github.com/users/octocat"
83
+ },
84
+ "committer": {
85
+ "login": "octocat",
86
+ "id": 1,
87
+ "avatar_url": "https://github.com/images/error/octocat_happy.gif",
88
+ "gravatar_id": "somehexcode",
89
+ "url": "https://api.github.com/users/octocat"
90
+ },
91
+ "parents": [
92
+ {
93
+ "url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
94
+ "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
95
+ }
96
+ ]
97
+ }
98
+ ],
99
+ "files": [
100
+ {
101
+ "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
102
+ "filename": "file1.txt",
103
+ "status": "added",
104
+ "additions": 103,
105
+ "deletions": 21,
106
+ "changes": 124,
107
+ "blob_url": "https://github.com/octocate/Hello-World/blob/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt",
108
+ "raw_url": "https://github.com/octocate/Hello-World/raw/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt",
109
+ "patch": "@@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test"
110
+ }
111
+ ]
112
+ }
@@ -2,7 +2,8 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe Github::ApiFactory, :type => :base do
5
+ describe Github::ApiFactory do
6
+
6
7
  context '#new' do
7
8
  it 'throws error if klass type is ommitted' do
8
9
  expect { described_class.new nil }.to raise_error(ArgumentError)
@@ -12,4 +13,19 @@ describe Github::ApiFactory, :type => :base do
12
13
  described_class.new('Repos').should be_a Github::Repos
13
14
  end
14
15
  end
16
+
17
+ context '#create_instance' do
18
+ it 'sets api client' do
19
+ instance = Github::Issues::Labels.new
20
+ Github.should_receive(:api_client=).twice().and_return instance
21
+ described_class.create_instance('Issues::Labels', {})
22
+ end
23
+ end
24
+
25
+ context '#convert_to_constant' do
26
+ it 'knows how to convert nested classes' do
27
+ described_class.convert_to_constant('Issues::Labels').
28
+ should == Github::Issues::Labels
29
+ end
30
+ end
15
31
  end # Github::ApiFactory
@@ -15,6 +15,8 @@ describe Github::Authorizations do
15
15
  end
16
16
 
17
17
  describe "authorizations" do
18
+ it { github.authorizations.should respond_to :all }
19
+
18
20
  context "resource found" do
19
21
  before do
20
22
  stub_get("/authorizations", "https://#{basic_auth}@api.github.com").
@@ -24,33 +26,33 @@ describe Github::Authorizations do
24
26
 
25
27
  it "should fail to get resource without basic authentication" do
26
28
  reset_authentication_for github
27
- expect { github.oauth.authorizations }.to raise_error(ArgumentError)
29
+ expect { github.oauth.list }.to raise_error(ArgumentError)
28
30
  end
29
31
 
30
32
  it "should get the resources" do
31
- github.oauth.authorizations
33
+ github.oauth.list
32
34
  a_get("/authorizations", "https://#{basic_auth}@api.github.com").should have_been_made
33
35
  end
34
36
 
35
37
  it "should return array of resources" do
36
- authorizations = github.oauth.authorizations
38
+ authorizations = github.oauth.list
37
39
  authorizations.should be_an Array
38
40
  authorizations.should have(1).items
39
41
  end
40
42
 
41
43
  it "should be a mash type" do
42
- authorizations = github.oauth.authorizations
44
+ authorizations = github.oauth.list
43
45
  authorizations.first.should be_a Hashie::Mash
44
46
  end
45
47
 
46
48
  it "should get authorization information" do
47
- authorizations = github.oauth.authorizations
49
+ authorizations = github.oauth.list
48
50
  authorizations.first.token.should == 'abc123'
49
51
  end
50
52
 
51
53
  it "should yield to a block" do
52
- github.oauth.should_receive(:authorizations).and_yield('web')
53
- github.oauth.authorizations { |param| 'web' }
54
+ github.oauth.should_receive(:list).and_yield('web')
55
+ github.oauth.list { |param| 'web' }
54
56
  end
55
57
  end
56
58
 
@@ -61,12 +63,12 @@ describe Github::Authorizations do
61
63
  end
62
64
 
63
65
  it "should return 404 with a message 'Not Found'" do
64
- expect { github.oauth.authorizations }.to raise_error(Github::Error::NotFound)
66
+ expect { github.oauth.list }.to raise_error(Github::Error::NotFound)
65
67
  end
66
68
  end
67
69
  end # authorizations
68
70
 
69
- describe "authorization" do
71
+ describe "#get" do
70
72
  let(:authorization_id) { 1 }
71
73
 
72
74
  context "resource found" do
@@ -76,22 +78,22 @@ describe Github::Authorizations do
76
78
  end
77
79
 
78
80
  it "should fail to get resource without authorization id" do
79
- expect { github.oauth.authorization nil }.to raise_error(ArgumentError)
81
+ expect { github.oauth.get nil }.to raise_error(ArgumentError)
80
82
  end
81
83
 
82
84
  it "should get the resource" do
83
- github.oauth.authorization authorization_id
85
+ github.oauth.get authorization_id
84
86
  a_get("/authorizations/#{authorization_id}", "https://#{basic_auth}@api.github.com").should have_been_made
85
87
  end
86
88
 
87
89
  it "should get authorization information" do
88
- authorization = github.oauth.authorization authorization_id
90
+ authorization = github.oauth.get authorization_id
89
91
  authorization.id.should == authorization_id
90
92
  authorization.token.should == 'abc123'
91
93
  end
92
94
 
93
95
  it "should return mash" do
94
- authorization = github.oauth.authorization authorization_id
96
+ authorization = github.oauth.get authorization_id
95
97
  authorization.should be_a Hashie::Mash
96
98
  end
97
99
  end
@@ -104,20 +106,20 @@ describe Github::Authorizations do
104
106
 
105
107
  it "should fail to retrive resource" do
106
108
  expect {
107
- github.oauth.authorization authorization_id
109
+ github.oauth.get authorization_id
108
110
  }.to raise_error(Github::Error::NotFound)
109
111
  end
110
112
  end
111
- end # authorization
113
+ end # list
112
114
 
113
- describe "create_authorization" do
115
+ describe "#create" do
114
116
  let(:inputs) { { :scopes => ['repo'] } }
115
117
 
116
118
  context "resouce created" do
117
119
 
118
120
  it "should fail to get resource without basic authentication" do
119
121
  reset_authentication_for github
120
- expect { github.oauth.create_authorization }.to raise_error(ArgumentError)
122
+ expect { github.oauth.create }.to raise_error(ArgumentError)
121
123
  end
122
124
 
123
125
  before do
@@ -126,17 +128,17 @@ describe Github::Authorizations do
126
128
  end
127
129
 
128
130
  it "should create resource successfully" do
129
- github.oauth.create_authorization inputs
131
+ github.oauth.create inputs
130
132
  a_post("/authorizations", "https://#{basic_auth}@api.github.com").with(inputs).should have_been_made
131
133
  end
132
134
 
133
135
  it "should return the resource" do
134
- authorization = github.oauth.create_authorization inputs
136
+ authorization = github.oauth.create inputs
135
137
  authorization.should be_a Hashie::Mash
136
138
  end
137
139
 
138
140
  it "should get the authorization information" do
139
- authorization = github.oauth.create_authorization inputs
141
+ authorization = github.oauth.create inputs
140
142
  authorization.token.should == 'abc123'
141
143
  end
142
144
  end
@@ -150,13 +152,13 @@ describe Github::Authorizations do
150
152
 
151
153
  it "should fail to retrieve resource" do
152
154
  expect {
153
- github.oauth.create_authorization inputs
155
+ github.oauth.create inputs
154
156
  }.to raise_error(Github::Error::NotFound)
155
157
  end
156
158
  end
157
- end # create_authorization
159
+ end # create
158
160
 
159
- describe "update_authorization" do
161
+ describe "#update" do
160
162
  let(:authorization_id) { 1 }
161
163
  let(:inputs) { { :add_scopes => ['repo'] } }
162
164
 
@@ -164,7 +166,7 @@ describe Github::Authorizations do
164
166
 
165
167
  it "should fail to get resource without basic authentication" do
166
168
  reset_authentication_for github
167
- expect { github.oauth.update_authorization }.to raise_error(ArgumentError)
169
+ expect { github.oauth.update }.to raise_error(ArgumentError)
168
170
  end
169
171
 
170
172
  before do
@@ -173,17 +175,17 @@ describe Github::Authorizations do
173
175
  end
174
176
 
175
177
  it "should update resource successfully" do
176
- github.oauth.update_authorization authorization_id, inputs
178
+ github.oauth.update authorization_id, inputs
177
179
  a_patch("/authorizations/#{authorization_id}", "https://#{basic_auth}@api.github.com").with(inputs).should have_been_made
178
180
  end
179
181
 
180
182
  it "should return the resource" do
181
- authorization = github.oauth.update_authorization authorization_id, inputs
183
+ authorization = github.oauth.update authorization_id, inputs
182
184
  authorization.should be_a Hashie::Mash
183
185
  end
184
186
 
185
187
  it "should get the authorization information" do
186
- authorization = github.oauth.update_authorization authorization_id, inputs
188
+ authorization = github.oauth.update authorization_id, inputs
187
189
  authorization.token.should == 'abc123'
188
190
  end
189
191
  end
@@ -197,13 +199,13 @@ describe Github::Authorizations do
197
199
 
198
200
  it "should fail to retrieve resource" do
199
201
  expect {
200
- github.oauth.update_authorization authorization_id, inputs
202
+ github.oauth.update authorization_id, inputs
201
203
  }.to raise_error(Github::Error::NotFound)
202
204
  end
203
205
  end
204
- end # update_authorization
206
+ end # update
205
207
 
206
- describe "delete_authorization" do
208
+ describe "#delete" do
207
209
  let(:authorization_id) { 1 }
208
210
  let(:inputs) { { :add_scopes => ['repo'] } }
209
211
 
@@ -211,7 +213,7 @@ describe Github::Authorizations do
211
213
 
212
214
  it "should fail to get resource without basic authentication" do
213
215
  reset_authentication_for github
214
- expect { github.oauth.delete_authorization nil }.to raise_error(ArgumentError)
216
+ expect { github.oauth.delete nil }.to raise_error(ArgumentError)
215
217
  end
216
218
 
217
219
  before do
@@ -220,7 +222,7 @@ describe Github::Authorizations do
220
222
  end
221
223
 
222
224
  it "should delete resource successfully" do
223
- github.oauth.delete_authorization authorization_id
225
+ github.oauth.delete authorization_id
224
226
  a_delete("/authorizations/#{authorization_id}", "https://#{basic_auth}@api.github.com").should have_been_made
225
227
  end
226
228
  end
@@ -234,10 +236,10 @@ describe Github::Authorizations do
234
236
 
235
237
  it "should fail to retrieve resource" do
236
238
  expect {
237
- github.oauth.delete_authorization authorization_id
239
+ github.oauth.delete authorization_id
238
240
  }.to raise_error(Github::Error::NotFound)
239
241
  end
240
242
  end
241
- end # delete_authorization
243
+ end # delete
242
244
 
243
245
  end # Github::Authorizations