github_api 0.4.11 → 0.5.0.rc1

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 (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
@@ -2,6 +2,35 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
+
5
6
  describe Github::Request do
6
- pending
7
- end
7
+ let(:github) { Github::API.new }
8
+ let(:path) { 'github.api/repos/users' }
9
+ let(:params) { {} }
10
+ let(:options) { {} }
11
+
12
+ it "knows how to make get request" do
13
+ github.should_receive(:request).with(:get, path, params, options)
14
+ github.get_request path, params, options
15
+ end
16
+
17
+ it "knows how to make patch request" do
18
+ github.should_receive(:request).with(:patch, path, params, options)
19
+ github.patch_request path, params, options
20
+ end
21
+
22
+ it "knows how to make post request" do
23
+ github.should_receive(:request).with(:post, path, params, options)
24
+ github.post_request path, params, options
25
+ end
26
+
27
+ it "knows how to make put request" do
28
+ github.should_receive(:request).with(:put, path, params, options)
29
+ github.put_request path, params, options
30
+ end
31
+
32
+ it "knows how to make delete request" do
33
+ github.should_receive(:request).with(:delete, path, params, options)
34
+ github.delete_request path, params, options
35
+ end
36
+ end # Github::Request
@@ -7,7 +7,9 @@ describe Github::Users::Emails do
7
7
  before { github.oauth_token = OAUTH_TOKEN }
8
8
  after { reset_authentication_for github }
9
9
 
10
- describe "#emails" do
10
+ describe "#list" do
11
+ it { github.users.emails.should respond_to :all }
12
+
11
13
  context "resource found for an authenticated user" do
12
14
  before do
13
15
  stub_get("/user/emails").
@@ -18,26 +20,26 @@ describe Github::Users::Emails do
18
20
  end
19
21
 
20
22
  it "should get the resources" do
21
- github.users.emails
23
+ github.users.emails.list
22
24
  a_get("/user/emails").
23
25
  with(:query => { :access_token => "#{OAUTH_TOKEN}"}).
24
26
  should have_been_made
25
27
  end
26
28
 
27
29
  it "should return resource" do
28
- emails = github.users.emails
30
+ emails = github.users.emails.list
29
31
  emails.should be_an Array
30
32
  emails.should have(2).items
31
33
  end
32
34
 
33
35
  it "should get emails information" do
34
- emails = github.users.emails
36
+ emails = github.users.emails.list
35
37
  emails.first.should == email
36
38
  end
37
39
 
38
40
  it "should yield to a block" do
39
- github.users.should_receive(:emails).and_yield('web')
40
- github.users.emails { |param| 'web' }
41
+ github.users.emails.should_receive(:list).and_yield('web')
42
+ github.users.emails.list { |param| 'web' }
41
43
  end
42
44
  end
43
45
 
@@ -50,13 +52,13 @@ describe Github::Users::Emails do
50
52
 
51
53
  it "should return 404 with a message 'Not Found'" do
52
54
  expect {
53
- github.users.emails
55
+ github.users.emails.list
54
56
  }.to raise_error(Github::Error::NotFound)
55
57
  end
56
58
  end
57
59
  end # emails
58
60
 
59
- context '#add_email' do
61
+ context '#add' do
60
62
  let(:params) { { :per_page => 21, :page => 1 }}
61
63
 
62
64
  before do
@@ -68,20 +70,20 @@ describe Github::Users::Emails do
68
70
  end
69
71
 
70
72
  it 'extracts request parameters and email data' do
71
- github.users.should_receive(:post).
73
+ github.users.emails.should_receive(:post_request).
72
74
  with("/user/emails", { "per_page" => 21, "page" => 1, "data" => [email] })
73
- github.users.add_email email, params
75
+ github.users.emails.add email, params
74
76
  end
75
77
 
76
78
  it 'submits request successfully' do
77
- github.users.add_email email
79
+ github.users.emails.add email
78
80
  a_post("/user/emails").
79
81
  with(:query => { :access_token => "#{OAUTH_TOKEN}"}).
80
82
  should have_been_made
81
83
  end
82
- end # add_email
84
+ end # add
83
85
 
84
- context '#delete_email' do
86
+ context '#delete' do
85
87
  let(:params) { { :per_page => 21, :page => 1 }}
86
88
 
87
89
  before do
@@ -93,17 +95,17 @@ describe Github::Users::Emails do
93
95
  end
94
96
 
95
97
  it 'extracts request parameters and email data' do
96
- github.users.should_receive(:delete).
98
+ github.users.emails.should_receive(:delete_request).
97
99
  with("/user/emails", { "per_page" => 21, "page" => 1, "data" => [email] })
98
- github.users.delete_email email, params
100
+ github.users.emails.delete email, params
99
101
  end
100
102
 
101
103
  it 'submits request successfully' do
102
- github.users.delete_email email
104
+ github.users.emails.delete email
103
105
  a_delete("/user/emails").
104
106
  with(:query => { :access_token => "#{OAUTH_TOKEN}", :data => email } ).
105
107
  should have_been_made
106
108
  end
107
- end # delete_email
109
+ end # delete
108
110
 
109
111
  end # Github::Users::Emails
@@ -8,7 +8,9 @@ describe Github::Users::Followers do
8
8
 
9
9
  after { reset_authentication_for github }
10
10
 
11
- describe "#followers" do
11
+ describe "#list" do
12
+ it { github.users.followers.should respond_to :all }
13
+
12
14
  context "resource found for a user" do
13
15
  before do
14
16
  stub_get("/users/#{user}/followers").
@@ -18,29 +20,29 @@ describe Github::Users::Followers do
18
20
  end
19
21
 
20
22
  it "should get the resources" do
21
- github.users.followers user
23
+ github.users.followers.list user
22
24
  a_get("/users/#{user}/followers").should have_been_made
23
25
  end
24
26
 
25
27
  it "should return resource" do
26
- followers = github.users.followers user
28
+ followers = github.users.followers.list user
27
29
  followers.should be_an Array
28
30
  followers.should have(1).items
29
31
  end
30
32
 
31
33
  it "should be a mash type" do
32
- followers = github.users.followers user
34
+ followers = github.users.followers.list user
33
35
  followers.first.should be_a Hashie::Mash
34
36
  end
35
37
 
36
38
  it "should get followers information" do
37
- followers = github.users.followers user
39
+ followers = github.users.followers.list user
38
40
  followers.first.login.should == 'octocat'
39
41
  end
40
42
 
41
43
  it "should yield to a block" do
42
- github.users.should_receive(:followers).with(user).and_yield('web')
43
- github.users.followers(user) { |param| 'web' }
44
+ github.users.followers.should_receive(:list).with(user).and_yield('web')
45
+ github.users.followers.list(user) { |param| 'web' }
44
46
  end
45
47
  end
46
48
 
@@ -55,7 +57,7 @@ describe Github::Users::Followers do
55
57
  end
56
58
 
57
59
  it "should get the resources" do
58
- github.users.followers
60
+ github.users.followers.list
59
61
  a_get("/user/followers").
60
62
  with(:query => { :access_token => "#{OAUTH_TOKEN}"}).
61
63
  should have_been_made
@@ -70,11 +72,11 @@ describe Github::Users::Followers do
70
72
 
71
73
  it "should return 404 with a message 'Not Found'" do
72
74
  expect {
73
- github.users.followers user
75
+ github.users.followers.list user
74
76
  }.to raise_error(Github::Error::NotFound)
75
77
  end
76
78
  end
77
- end # followers
79
+ end # list
78
80
 
79
81
  describe "#following" do
80
82
  context "resource found for a user" do
@@ -86,29 +88,29 @@ describe Github::Users::Followers do
86
88
  end
87
89
 
88
90
  it "should get the resources" do
89
- github.users.following user
91
+ github.users.followers.following user
90
92
  a_get("/users/#{user}/following").should have_been_made
91
93
  end
92
94
 
93
95
  it "should return resource" do
94
- followings = github.users.following user
96
+ followings = github.users.followers.following user
95
97
  followings.should be_an Array
96
98
  followings.should have(1).items
97
99
  end
98
100
 
99
101
  it "should be a mash type" do
100
- followings = github.users.following user
102
+ followings = github.users.followers.following user
101
103
  followings.first.should be_a Hashie::Mash
102
104
  end
103
105
 
104
106
  it "should get following users information" do
105
- followings = github.users.following user
107
+ followings = github.users.followers.following user
106
108
  followings.first.login.should == 'octocat'
107
109
  end
108
110
 
109
111
  it "should yield to a block" do
110
- github.users.should_receive(:following).with(user).and_yield('web')
111
- github.users.following(user) { |param| 'web' }
112
+ github.users.followers.should_receive(:following).with(user).and_yield('web')
113
+ github.users.followers.following(user) { |param| 'web' }
112
114
  end
113
115
  end
114
116
 
@@ -123,7 +125,7 @@ describe Github::Users::Followers do
123
125
  end
124
126
 
125
127
  it "should get the resources" do
126
- github.users.following
128
+ github.users.followers.following
127
129
  a_get("/user/following").
128
130
  with(:query => { :access_token => "#{OAUTH_TOKEN}"}).
129
131
  should have_been_made
@@ -138,7 +140,7 @@ describe Github::Users::Followers do
138
140
 
139
141
  it "should return 404 with a message 'Not Found'" do
140
142
  expect {
141
- github.users.following user
143
+ github.users.followers.following user
142
144
  }.to raise_error(Github::Error::NotFound)
143
145
  end
144
146
  end
@@ -156,19 +158,19 @@ describe Github::Users::Followers do
156
158
 
157
159
  it 'should raise error if username not present' do
158
160
  expect {
159
- github.users.following? nil
161
+ github.users.followers.following? nil
160
162
  }.to raise_error(ArgumentError)
161
163
  end
162
164
 
163
165
  it 'should perform request' do
164
- github.users.following?(user)
166
+ github.users.followers.following?(user)
165
167
  a_get("/user/following/#{user}").
166
168
  with(:query => { :access_token => "#{OAUTH_TOKEN}"}).
167
169
  should have_been_made
168
170
  end
169
171
 
170
172
  it 'should return true if user is being followed' do
171
- github.users.following?(user).should be_true
173
+ github.users.followers.following?(user).should be_true
172
174
  end
173
175
 
174
176
  it 'should return false if user is not being followed' do
@@ -177,7 +179,7 @@ describe Github::Users::Followers do
177
179
  to_return(:body => '',
178
180
  :status => 404,
179
181
  :headers => {:content_type => "application/json; charset=utf-8"})
180
- github.users.following?(user).should be_false
182
+ github.users.followers.following?(user).should be_false
181
183
  end
182
184
  end # following?
183
185
 
@@ -193,19 +195,19 @@ describe Github::Users::Followers do
193
195
 
194
196
  it "should raise error if gist id not present" do
195
197
  expect {
196
- github.users.follow nil
198
+ github.users.followers.follow nil
197
199
  }.to raise_error(ArgumentError)
198
200
  end
199
201
 
200
202
  it 'successfully unfollows a user' do
201
- github.users.follow(user)
203
+ github.users.followers.follow(user)
202
204
  a_put("/user/following/#{user}").
203
205
  with(:query => { :access_token => "#{OAUTH_TOKEN}"}).
204
206
  should have_been_made
205
207
  end
206
208
 
207
209
  it "should return 204 with a message 'Not Found'" do
208
- github.users.follow(user).status.should be 204
210
+ github.users.followers.follow(user).status.should be 204
209
211
  end
210
212
  end # follow
211
213
 
@@ -221,19 +223,19 @@ describe Github::Users::Followers do
221
223
 
222
224
  it "should raise error if gist id not present" do
223
225
  expect {
224
- github.users.unfollow nil
226
+ github.users.followers.unfollow nil
225
227
  }.to raise_error(ArgumentError)
226
228
  end
227
229
 
228
230
  it 'successfully unfollows a user' do
229
- github.users.unfollow(user)
231
+ github.users.followers.unfollow(user)
230
232
  a_delete("/user/following/#{user}").
231
233
  with(:query => { :access_token => "#{OAUTH_TOKEN}"}).
232
234
  should have_been_made
233
235
  end
234
236
 
235
237
  it "should return 204 with a message 'Not Found'" do
236
- github.users.unfollow(user).status.should be 204
238
+ github.users.followers.unfollow(user).status.should be 204
237
239
  end
238
240
  end # unfollow
239
241
 
@@ -7,7 +7,9 @@ describe Github::Users::Keys do
7
7
  before { github.oauth_token = OAUTH_TOKEN }
8
8
  after { reset_authentication_for github }
9
9
 
10
- describe "#keys" do
10
+ describe "#list" do
11
+ it { github.users.keys.should respond_to :all }
12
+
11
13
  context "resource found for an authenticated user" do
12
14
  before do
13
15
  stub_get("/user/keys").
@@ -18,26 +20,26 @@ describe Github::Users::Keys do
18
20
  end
19
21
 
20
22
  it "should get the resources" do
21
- github.users.keys
23
+ github.users.keys.list
22
24
  a_get("/user/keys").
23
25
  with(:query => { :access_token => "#{OAUTH_TOKEN}"}).
24
26
  should have_been_made
25
27
  end
26
28
 
27
29
  it "should return resource" do
28
- keys = github.users.keys
30
+ keys = github.users.keys.list
29
31
  keys.should be_an Array
30
32
  keys.should have(1).item
31
33
  end
32
34
 
33
35
  it "should get keys information" do
34
- keys = github.users.keys
36
+ keys = github.users.keys.list
35
37
  keys.first.id.should == key_id
36
38
  end
37
39
 
38
40
  it "should yield to a block" do
39
- github.users.should_receive(:keys).and_yield('web')
40
- github.users.keys { |param| 'web' }
41
+ github.users.keys.should_receive(:list).and_yield('web')
42
+ github.users.keys.list { |param| 'web' }
41
43
  end
42
44
  end
43
45
 
@@ -50,13 +52,15 @@ describe Github::Users::Keys do
50
52
 
51
53
  it "should return 404 with a message 'Not Found'" do
52
54
  expect {
53
- github.users.keys
55
+ github.users.keys.list
54
56
  }.to raise_error(Github::Error::NotFound)
55
57
  end
56
58
  end
57
- end # keys
59
+ end # list
60
+
61
+ describe "#get" do
62
+ it { github.users.keys.should respond_to :find }
58
63
 
59
- describe "#key" do
60
64
  context "resource found for an authenticated user" do
61
65
  before do
62
66
  stub_get("/user/keys/#{key_id}").
@@ -67,24 +71,24 @@ describe Github::Users::Keys do
67
71
  end
68
72
 
69
73
  it "should fail to get resource without key id" do
70
- expect { github.users.key nil }.to raise_error(ArgumentError)
74
+ expect { github.users.keys.get nil }.to raise_error(ArgumentError)
71
75
  end
72
76
 
73
77
  it "should get the resource" do
74
- github.users.key key_id
78
+ github.users.keys.get key_id
75
79
  a_get("/user/keys/#{key_id}").
76
80
  with(:query => { :access_token => "#{OAUTH_TOKEN}"}).
77
81
  should have_been_made
78
82
  end
79
83
 
80
84
  it "should get public key information" do
81
- key = github.users.key key_id
85
+ key = github.users.keys.get key_id
82
86
  key.id.should == key_id
83
87
  key.title.should == 'octocat@octomac'
84
88
  end
85
89
 
86
90
  it "should return mash" do
87
- key = github.users.key key_id
91
+ key = github.users.keys.get key_id
88
92
  key.should be_a Hashie::Mash
89
93
  end
90
94
  end
@@ -100,13 +104,13 @@ describe Github::Users::Keys do
100
104
 
101
105
  it "should fail to retrive resource" do
102
106
  expect {
103
- github.users.key key_id
107
+ github.users.keys.get key_id
104
108
  }.to raise_error(Github::Error::NotFound)
105
109
  end
106
110
  end
107
- end # key
111
+ end # get
108
112
 
109
- describe "create_key" do
113
+ describe "#create" do
110
114
  let(:inputs) {
111
115
  {
112
116
  :title => "octocat@octomac",
@@ -125,18 +129,18 @@ describe Github::Users::Keys do
125
129
  end
126
130
 
127
131
  it "should create resource successfully" do
128
- github.users.create_key inputs
132
+ github.users.keys.create inputs
129
133
  a_post("/user/keys?access_token=#{OAUTH_TOKEN}").
130
134
  with(inputs).should have_been_made
131
135
  end
132
136
 
133
137
  it "should return the resource" do
134
- key = github.users.create_key inputs
138
+ key = github.users.keys.create inputs
135
139
  key.should be_a Hashie::Mash
136
140
  end
137
141
 
138
142
  it "should get the key information" do
139
- key = github.users.create_key inputs
143
+ key = github.users.keys.create inputs
140
144
  key.title.should == 'octocat@octomac'
141
145
  end
142
146
  end
@@ -151,13 +155,13 @@ describe Github::Users::Keys do
151
155
 
152
156
  it "should fail to retrieve resource" do
153
157
  expect {
154
- github.users.create_key inputs
158
+ github.users.keys.create inputs
155
159
  }.to raise_error(Github::Error::NotFound)
156
160
  end
157
161
  end
158
- end # create_key
162
+ end # create
159
163
 
160
- describe "#update_key" do
164
+ describe "#update" do
161
165
  let(:inputs) {
162
166
  {
163
167
  :title => "octocat@octomac",
@@ -176,22 +180,22 @@ describe Github::Users::Keys do
176
180
  end
177
181
 
178
182
  it "should fail to get resource without key id" do
179
- expect { github.users.update_key nil }.to raise_error(ArgumentError)
183
+ expect { github.users.keys.update nil }.to raise_error(ArgumentError)
180
184
  end
181
185
 
182
186
  it "should create resource successfully" do
183
- github.users.update_key key_id, inputs
187
+ github.users.keys.update key_id, inputs
184
188
  a_patch("/user/keys/#{key_id}?access_token=#{OAUTH_TOKEN}").
185
189
  with(inputs).should have_been_made
186
190
  end
187
191
 
188
192
  it "should return the resource" do
189
- key = github.users.update_key key_id, inputs
193
+ key = github.users.keys.update key_id, inputs
190
194
  key.should be_a Hashie::Mash
191
195
  end
192
196
 
193
197
  it "should get the key information" do
194
- key = github.users.update_key key_id, inputs
198
+ key = github.users.keys.update key_id, inputs
195
199
  key.title.should == 'octocat@octomac'
196
200
  end
197
201
  end
@@ -207,13 +211,13 @@ describe Github::Users::Keys do
207
211
 
208
212
  it "should fail to retrieve resource" do
209
213
  expect {
210
- github.users.update_key key_id, inputs
214
+ github.users.keys.update key_id, inputs
211
215
  }.to raise_error(Github::Error::NotFound)
212
216
  end
213
217
  end
214
- end # update_key
218
+ end # update
215
219
 
216
- describe "#delete_key" do
220
+ describe "#delete" do
217
221
  context "resouce deleted" do
218
222
  before do
219
223
  stub_delete("/user/keys/#{key_id}?access_token=#{OAUTH_TOKEN}").
@@ -223,11 +227,11 @@ describe Github::Users::Keys do
223
227
  end
224
228
 
225
229
  it "should fail to get resource without key id" do
226
- expect { github.users.delete_key nil }.to raise_error(ArgumentError)
230
+ expect { github.users.keys.delete nil }.to raise_error(ArgumentError)
227
231
  end
228
232
 
229
233
  it "should create resource successfully" do
230
- github.users.delete_key key_id
234
+ github.users.keys.delete key_id
231
235
  a_delete("/user/keys/#{key_id}?access_token=#{OAUTH_TOKEN}").
232
236
  should have_been_made
233
237
  end
@@ -243,10 +247,10 @@ describe Github::Users::Keys do
243
247
 
244
248
  it "should fail to delete resource" do
245
249
  expect {
246
- github.users.delete_key key_id
250
+ github.users.keys.delete key_id
247
251
  }.to raise_error(Github::Error::NotFound)
248
252
  end
249
253
  end
250
- end # delete_key
254
+ end # delete
251
255
 
252
256
  end # Github::Users::Keys