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
@@ -8,39 +8,45 @@ describe Github::Orgs do
8
8
  let(:repo) { 'github' }
9
9
  let(:org) { 'github' }
10
10
 
11
- after { github.user, github.repo, github.oauth_token = nil, nil, nil }
11
+ after { reset_authentication_for github }
12
12
 
13
- describe "orgs" do
13
+ context 'access to apis' do
14
+ it { subject.members.should be_a Github::Orgs::Members }
15
+ it { subject.teams.should be_a Github::Orgs::Teams }
16
+ end
17
+
18
+ describe "#list" do
14
19
  context "resource found for a user" do
15
20
  before do
16
21
  stub_get("/users/#{user}/orgs").
17
- to_return(:body => fixture('orgs/orgs.json'), :status => 200, :headers => {:content_type => "application/json; charset=utf-8"})
22
+ to_return(:body => fixture('orgs/orgs.json'), :status => 200,
23
+ :headers => {:content_type => "application/json; charset=utf-8"})
18
24
  end
19
25
 
20
26
  it "should get the resources" do
21
- github.orgs.orgs user
27
+ github.orgs.list user
22
28
  a_get("/users/#{user}/orgs").should have_been_made
23
29
  end
24
30
 
25
31
  it "should return array of resources" do
26
- orgs = github.orgs.orgs user
32
+ orgs = github.orgs.list user
27
33
  orgs.should be_an Array
28
34
  orgs.should have(1).items
29
35
  end
30
36
 
31
37
  it "should be a mash type" do
32
- orgs = github.orgs.orgs user
38
+ orgs = github.orgs.list user
33
39
  orgs.first.should be_a Hashie::Mash
34
40
  end
35
41
 
36
42
  it "should get org information" do
37
- orgs = github.orgs.orgs user
43
+ orgs = github.orgs.list user
38
44
  orgs.first.login.should == 'github'
39
45
  end
40
46
 
41
47
  it "should yield to a block" do
42
- github.orgs.should_receive(:orgs).with(user).and_yield('web')
43
- github.orgs.orgs(user) { |param| 'web' }
48
+ github.orgs.should_receive(:list).with(user).and_yield('web')
49
+ github.orgs.list(user) { |param| 'web' }
44
50
  end
45
51
  end
46
52
 
@@ -49,13 +55,14 @@ describe Github::Orgs do
49
55
  github.oauth_token = OAUTH_TOKEN
50
56
  stub_get("/user/orgs").
51
57
  with(:query => { :access_token => OAUTH_TOKEN }).
52
- to_return(:body => fixture('orgs/orgs.json'), :status => 200, :headers => {:content_type => "application/json; charset=utf-8"})
58
+ to_return(:body => fixture('orgs/orgs.json'), :status => 200,
59
+ :headers => {:content_type => "application/json; charset=utf-8"})
53
60
  end
54
61
 
55
- after { github.oauth_token = nil }
62
+ # after { github.oauth_token = nil }
56
63
 
57
64
  it "should get the resources" do
58
- github.orgs.orgs
65
+ github.orgs.list
59
66
  a_get("/user/orgs").with(:query => { :access_token => OAUTH_TOKEN }).
60
67
  should have_been_made
61
68
  end
@@ -69,13 +76,13 @@ describe Github::Orgs do
69
76
 
70
77
  it "should return 404 with a message 'Not Found'" do
71
78
  expect {
72
- github.orgs.orgs user
79
+ github.orgs.list user
73
80
  }.to raise_error(Github::Error::NotFound)
74
81
  end
75
82
  end
76
- end # orgs
83
+ end # list
77
84
 
78
- describe "org" do
85
+ describe "#get" do
79
86
  context "resource found" do
80
87
  before do
81
88
  stub_get("/orgs/#{org}").
@@ -83,22 +90,22 @@ describe Github::Orgs do
83
90
  end
84
91
 
85
92
  it "should fail to get resource without org name" do
86
- expect { github.orgs.org }.to raise_error(ArgumentError)
93
+ expect { github.orgs.get }.to raise_error(ArgumentError)
87
94
  end
88
95
 
89
96
  it "should get the resource" do
90
- github.orgs.org org
97
+ github.orgs.get org
91
98
  a_get("/orgs/#{org}").should have_been_made
92
99
  end
93
100
 
94
101
  it "should get org information" do
95
- organisation = github.orgs.org org
102
+ organisation = github.orgs.get org
96
103
  organisation.id.should == 1
97
104
  organisation.login.should == 'github'
98
105
  end
99
106
 
100
107
  it "should return mash" do
101
- organisation = github.orgs.org org
108
+ organisation = github.orgs.get org
102
109
  organisation.should be_a Hashie::Mash
103
110
  end
104
111
  end
@@ -106,18 +113,19 @@ describe Github::Orgs do
106
113
  context "resource not found" do
107
114
  before do
108
115
  stub_get("/orgs/#{org}").
109
- to_return(:body => fixture('orgs/org.json'), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"})
116
+ to_return(:body => fixture('orgs/org.json'), :status => 404,
117
+ :headers => {:content_type => "application/json; charset=utf-8"})
110
118
  end
111
119
 
112
120
  it "should fail to retrive resource" do
113
121
  expect {
114
- github.orgs.org org
122
+ github.orgs.get org
115
123
  }.to raise_error(Github::Error::NotFound)
116
124
  end
117
125
  end
118
- end # org
126
+ end # get
119
127
 
120
- describe "edit_org" do
128
+ describe "#edit" do
121
129
  let(:inputs) do
122
130
  { :billing_email => 'support@github.com',
123
131
  :blog => "https://github.com/blog",
@@ -130,25 +138,26 @@ describe Github::Orgs do
130
138
  context "resource edited successfully" do
131
139
  before do
132
140
  stub_patch("/orgs/#{org}").with(inputs).
133
- to_return(:body => fixture("orgs/org.json"), :status => 200, :headers => { :content_type => "application/json; charset=utf-8"})
141
+ to_return(:body => fixture("orgs/org.json"), :status => 200,
142
+ :headers => { :content_type => "application/json; charset=utf-8"})
134
143
  end
135
144
 
136
145
  it "should fail to edit without 'user/repo' parameters" do
137
- expect { github.orgs.edit_org }.to raise_error(ArgumentError)
146
+ expect { github.orgs.edit }.to raise_error(ArgumentError)
138
147
  end
139
148
 
140
149
  it "should edit the resource" do
141
- github.orgs.edit_org org
150
+ github.orgs.edit org
142
151
  a_patch("/orgs/#{org}").with(inputs).should have_been_made
143
152
  end
144
153
 
145
154
  it "should return resource" do
146
- organisation = github.orgs.edit_org org
155
+ organisation = github.orgs.edit org
147
156
  organisation.should be_a Hashie::Mash
148
157
  end
149
158
 
150
159
  it "should be able to retrieve information" do
151
- organisation = github.orgs.edit_org org
160
+ organisation = github.orgs.edit org
152
161
  organisation.name.should == 'github'
153
162
  end
154
163
  end
@@ -156,15 +165,16 @@ describe Github::Orgs do
156
165
  context "failed to edit resource" do
157
166
  before do
158
167
  stub_patch("/orgs/#{org}").with(inputs).
159
- to_return(:body => fixture("orgs/org.json"), :status => 404, :headers => { :content_type => "application/json; charset=utf-8"})
168
+ to_return(:body => fixture("orgs/org.json"), :status => 404,
169
+ :headers => { :content_type => "application/json; charset=utf-8"})
160
170
  end
161
171
 
162
172
  it "should fail to find resource" do
163
173
  expect {
164
- github.orgs.edit_org org
174
+ github.orgs.edit org
165
175
  }.to raise_error(Github::Error::NotFound)
166
176
  end
167
177
  end
168
- end # edit_org
178
+ end # edit
169
179
 
170
180
  end # Github::Orgs
@@ -5,17 +5,19 @@ require 'spec_helper'
5
5
  describe Github::PagedRequest do
6
6
  it { described_class.constants.should include :FIRST_PAGE }
7
7
  it { described_class.constants.should include :PER_PAGE }
8
+ it { described_class.constants.should include :NOT_FOUND }
8
9
 
9
10
  context 'page_request' do
10
11
  let(:path) { '/repos' }
12
+ let(:client) { Github::Client }
11
13
 
12
14
  before do
13
- Github.new
15
+ Github.stub(:api_client).and_return client
16
+ client.stub(:get_request)
14
17
  end
15
18
 
16
19
  it 'sets default per_page when only custom page passed' do
17
20
  Github.stub_chain(:api_client, :per_page).and_return nil
18
- Github.stub_chain(:api_client, :get).and_return nil
19
21
  Github::PagedRequest.page_request path, {'page' => 3, 'per_page' => -1}
20
22
  Github::PagedRequest.page.should eq 3
21
23
  Github::PagedRequest.per_page.should eq 30
@@ -23,15 +25,14 @@ describe Github::PagedRequest do
23
25
 
24
26
  it 'sets default page when only custom per_page passed' do
25
27
  Github.stub_chain(:api_client, :page).and_return nil
26
- Github.stub_chain(:api_client, :get).and_return nil
27
28
  Github::PagedRequest.page_request path, {'per_page' => 33, 'page' => -1}
28
29
  Github::PagedRequest.page.should eq 1
29
30
  Github::PagedRequest.per_page.should eq 33
30
31
  end
31
32
 
32
33
  it 'sends get request with passed parameters' do
33
- Github.stub(:api_client).and_return Github::Client
34
- Github::Client.should_receive(:get).with(path, 'page' => 2, 'per_page' => 33)
34
+ Github::Client.should_receive(:get_request).
35
+ with(path, 'page' => 2, 'per_page' => 33)
35
36
  Github::PagedRequest.page_request path, {'page' => 2, 'per_page' => 33}
36
37
  end
37
38
  end
@@ -11,11 +11,8 @@ describe Github::PullRequests::Comments do
11
11
 
12
12
  after { reset_authentication_for github }
13
13
 
14
- describe "#comments" do
15
- context 'check aliases' do
16
- it { github.pull_requests.should respond_to :comments }
17
- it { github.pull_requests.should respond_to :request_comments }
18
- end
14
+ describe "#list" do
15
+ it { github.pull_requests.comments.should respond_to :all }
19
16
 
20
17
  context 'resource found' do
21
18
 
@@ -28,36 +25,36 @@ describe Github::PullRequests::Comments do
28
25
 
29
26
  it "throws error if comment id not provided" do
30
27
  expect {
31
- github.pull_requests.comments user, repo, nil
28
+ github.pull_requests.comments.list user, repo, nil
32
29
  }.to raise_error(ArgumentError)
33
30
  end
34
31
 
35
32
  it "should get the resources" do
36
- github.pull_requests.comments user, repo, pull_request_id
33
+ github.pull_requests.comments.list user, repo, pull_request_id
37
34
  a_get("/repos/#{user}/#{repo}/pulls/#{pull_request_id}/comments").
38
35
  should have_been_made
39
36
  end
40
37
 
41
38
  it "should return array of resources" do
42
- comments = github.pull_requests.comments user, repo, pull_request_id
39
+ comments = github.pull_requests.comments.list user, repo, pull_request_id
43
40
  comments.should be_an Array
44
41
  comments.should have(1).items
45
42
  end
46
43
 
47
44
  it "should be a mash type" do
48
- comments = github.pull_requests.comments user, repo, pull_request_id
45
+ comments = github.pull_requests.comments.list user, repo, pull_request_id
49
46
  comments.first.should be_a Hashie::Mash
50
47
  end
51
48
 
52
49
  it "should get pull request comment information" do
53
- comments = github.pull_requests.comments user, repo, pull_request_id
50
+ comments = github.pull_requests.comments.list user, repo, pull_request_id
54
51
  comments.first.id.should == pull_request_id
55
52
  end
56
53
 
57
54
  it "should yield to a block" do
58
- github.pull_requests.should_receive(:comments).
55
+ github.pull_requests.comments.should_receive(:list).
59
56
  with(user, repo, pull_request_id).and_yield('web')
60
- github.pull_requests.comments(user, repo, pull_request_id) {|param| 'web' }
57
+ github.pull_requests.comments.list(user, repo, pull_request_id) {|param| 'web' }
61
58
  end
62
59
  end
63
60
 
@@ -69,17 +66,14 @@ describe Github::PullRequests::Comments do
69
66
 
70
67
  it "should return 404 with a message 'Not Found'" do
71
68
  expect {
72
- github.pull_requests.comments user, repo, pull_request_id
69
+ github.pull_requests.comments.list user, repo, pull_request_id
73
70
  }.to raise_error(Github::Error::NotFound)
74
71
  end
75
72
  end
76
- end # comments
73
+ end # list
77
74
 
78
- describe "#comment" do
79
- context 'check aliases' do
80
- it { github.pull_requests.should respond_to :comment }
81
- it { github.pull_requests.should respond_to :get_comment }
82
- end
75
+ describe "#get" do
76
+ it { github.pull_requests.comments.should respond_to :find }
83
77
 
84
78
  context 'resource found' do
85
79
  before do
@@ -91,24 +85,24 @@ describe Github::PullRequests::Comments do
91
85
 
92
86
  it "should fail to get resource without comment id" do
93
87
  expect {
94
- github.pull_requests.comment user, repo, nil
88
+ github.pull_requests.comments.get user, repo, nil
95
89
  }.to raise_error(ArgumentError)
96
90
  end
97
91
 
98
92
  it "should get the resource" do
99
- github.pull_requests.comment user, repo, pull_request_id
93
+ github.pull_requests.comments.get user, repo, pull_request_id
100
94
  a_get("/repos/#{user}/#{repo}/pulls/comments/#{comment_id}").
101
95
  should have_been_made
102
96
  end
103
97
 
104
98
  it "should get comment information" do
105
- comment = github.pull_requests.comment user, repo, comment_id
99
+ comment = github.pull_requests.comments.get user, repo, comment_id
106
100
  comment.id.should eq comment_id
107
101
  comment.user.login.should == 'octocat'
108
102
  end
109
103
 
110
104
  it "should return mash" do
111
- comment = github.pull_requests.comment user, repo, comment_id
105
+ comment = github.pull_requests.comments.get user, repo, comment_id
112
106
  comment.should be_a Hashie::Mash
113
107
  end
114
108
  end
@@ -123,13 +117,13 @@ describe Github::PullRequests::Comments do
123
117
 
124
118
  it "should fail to retrive resource" do
125
119
  expect {
126
- github.pull_requests.comment user, repo, comment_id
120
+ github.pull_requests.comments.get user, repo, comment_id
127
121
  }.to raise_error(Github::Error::NotFound)
128
122
  end
129
123
  end
130
- end # comment
124
+ end # get
131
125
 
132
- describe "create_request" do
126
+ describe "#create" do
133
127
  let(:inputs) {
134
128
  {
135
129
  "body" => "Nice change",
@@ -150,23 +144,23 @@ describe Github::PullRequests::Comments do
150
144
 
151
145
  it 'raises error when pull_request_id is missing' do
152
146
  expect {
153
- github.pull_requests user, repo, nil
147
+ github.pull_requests.comments.create user, repo, nil
154
148
  }.to raise_error(ArgumentError)
155
149
  end
156
150
 
157
151
  it "should create resource successfully" do
158
- github.pull_requests.create_comment user, repo, pull_request_id, inputs
152
+ github.pull_requests.comments.create user, repo, pull_request_id, inputs
159
153
  a_post("/repos/#{user}/#{repo}/pulls/#{pull_request_id}/comments").
160
154
  with(inputs).should have_been_made
161
155
  end
162
156
 
163
157
  it "should return the resource" do
164
- pull_request = github.pull_requests.create_comment user, repo, pull_request_id, inputs
158
+ pull_request = github.pull_requests.comments.create user, repo, pull_request_id, inputs
165
159
  pull_request.should be_a Hashie::Mash
166
160
  end
167
161
 
168
162
  it "should get the request information" do
169
- pull_request = github.pull_requests.create_comment user, repo, pull_request_id, inputs
163
+ pull_request = github.pull_requests.comments.create user, repo, pull_request_id, inputs
170
164
  pull_request.id.should == pull_request_id
171
165
  end
172
166
  end
@@ -181,13 +175,13 @@ describe Github::PullRequests::Comments do
181
175
 
182
176
  it "should faile to retrieve resource" do
183
177
  expect {
184
- github.pull_requests.create_comment user, repo, pull_request_id, inputs
178
+ github.pull_requests.comments.create user, repo, pull_request_id, inputs
185
179
  }.to raise_error(Github::Error::NotFound)
186
180
  end
187
181
  end
188
- end # create_comment
182
+ end # create
189
183
 
190
- describe "#edit_comment" do
184
+ describe "#edit" do
191
185
  let(:inputs) {
192
186
  {
193
187
  "body" => "Nice change",
@@ -205,25 +199,26 @@ describe Github::PullRequests::Comments do
205
199
  end
206
200
 
207
201
  it "should edit resource successfully" do
208
- github.pull_requests.edit_comment user, repo, comment_id, inputs
202
+ github.pull_requests.comments.edit user, repo, comment_id, inputs
209
203
  a_patch("/repos/#{user}/#{repo}/pulls/comments/#{comment_id}").
210
204
  with(inputs).should have_been_made
211
205
  end
212
206
 
213
207
  it "should return the resource" do
214
- comment = github.pull_requests.edit_comment user, repo, comment_id, inputs
208
+ comment = github.pull_requests.comments.edit user, repo, comment_id, inputs
215
209
  comment.should be_a Hashie::Mash
216
210
  end
217
211
 
218
212
  it "should get the comment information" do
219
- comment = github.pull_requests.edit_comment user, repo, comment_id, inputs
213
+ comment = github.pull_requests.comments.edit user, repo, comment_id, inputs
220
214
  comment.user.login.should == 'octocat'
221
215
  end
222
216
  end
223
217
 
224
218
  context "failed to edit resource" do
225
219
  before do
226
- stub_patch("/repos/#{user}/#{repo}/pulls/comments/#{comment_id}").with(inputs).
220
+ stub_patch("/repos/#{user}/#{repo}/pulls/comments/#{comment_id}").
221
+ with(inputs).
227
222
  to_return(:body => fixture('pull_requests/comment.json'),
228
223
  :status => 404,
229
224
  :headers => {:content_type => "application/json; charset=utf-8"})
@@ -231,13 +226,13 @@ describe Github::PullRequests::Comments do
231
226
 
232
227
  it "should fail to retrieve resource" do
233
228
  expect {
234
- github.pull_requests.edit_comment user, repo, comment_id, inputs
229
+ github.pull_requests.comments.edit user, repo, comment_id, inputs
235
230
  }.to raise_error(Github::Error::NotFound)
236
231
  end
237
232
  end
238
- end # edit_comment
233
+ end # edit
239
234
 
240
- context "#delete_comment" do
235
+ context "#delete" do
241
236
  before do
242
237
  stub_delete("/repos/#{user}/#{repo}/pulls/comments/#{comment_id}").
243
238
  to_return(:body => fixture('pull_requests/comment.json'),
@@ -247,12 +242,12 @@ describe Github::PullRequests::Comments do
247
242
 
248
243
  it 'should raise error if comment_id not present' do
249
244
  expect {
250
- github.pull_requests.delete_comment user, repo, nil
245
+ github.pull_requests.comments.delete user, repo, nil
251
246
  }.to raise_error(ArgumentError)
252
247
  end
253
248
 
254
249
  it "should remove resource successfully" do
255
- github.pull_requests.delete_comment user, repo, comment_id
250
+ github.pull_requests.comments.delete user, repo, comment_id
256
251
  a_delete("/repos/#{user}/#{repo}/pulls/comments/#{comment_id}").
257
252
  should have_been_made
258
253
  end
@@ -263,9 +258,9 @@ describe Github::PullRequests::Comments do
263
258
  :status => 404,
264
259
  :headers => {:content_type => "application/json; charset=utf-8"})
265
260
  expect {
266
- github.pull_requests.delete_comment user, repo, comment_id
261
+ github.pull_requests.comments.delete user, repo, comment_id
267
262
  }.to raise_error(Github::Error::NotFound)
268
263
  end
269
- end # delete_comment
264
+ end # delete
270
265
 
271
266
  end # Github::PullRequests::Comments