Skip to content

Commit 476e89d

Browse files
committed
Change issues find call to get.
1 parent 7423a8b commit 476e89d

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

lib/github_api/issues.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ def list(params={})
124124
# :sort => 'comments',
125125
# :direction => 'asc'
126126
#
127+
# TODO: remove default nils from params
127128
def list_repo(user_name=nil, repo_name=nil, params={})
128129
_update_user_repo_params(user_name, repo_name)
129130
_validate_user_repo_params(user, repo) unless user? && repo?
@@ -143,9 +144,9 @@ def list_repo(user_name=nil, repo_name=nil, params={})
143144
#
144145
# = Examples
145146
# github = Github.new
146-
# github.issues.find 'user-name', 'repo-name', 'issue-id'
147+
# github.issues.get 'user-name', 'repo-name', 'issue-id'
147148
#
148-
def find(user_name, repo_name, issue_id, params={})
149+
def get(user_name, repo_name, issue_id, params={})
149150
_update_user_repo_params(user_name, repo_name)
150151
_validate_user_repo_params(user, repo) unless user? && repo?
151152
_validate_presence_of issue_id
@@ -155,6 +156,7 @@ def find(user_name, repo_name, issue_id, params={})
155156

156157
get_request("/repos/#{user}/#{repo}/issues/#{issue_id}", params)
157158
end
159+
alias :find :get
158160

159161
# Create an issue
160162
#

spec/github/issues_spec.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@
122122
end
123123
end # list_repo
124124

125-
describe "#find" do
125+
describe "#get" do
126+
it { github.issues.should respond_to :find }
126127

127128
context "resource found" do
128129
before do
@@ -133,22 +134,22 @@
133134
end
134135

135136
it "should fail to get resource without issue id" do
136-
expect { github.issues.find(user, repo, nil)}.to raise_error(ArgumentError)
137+
expect { github.issues.get(user, repo, nil)}.to raise_error(ArgumentError)
137138
end
138139

139140
it "should get the resource" do
140-
github.issues.find user, repo, issue_id
141+
github.issues.get user, repo, issue_id
141142
a_get("/repos/#{user}/#{repo}/issues/#{issue_id}").should have_been_made
142143
end
143144

144145
it "should get issue information" do
145-
issue = github.issues.find user, repo, issue_id
146+
issue = github.issues.get user, repo, issue_id
146147
issue.number.should == issue_id
147148
issue.title.should == 'Found a bug'
148149
end
149150

150151
it "should return mash" do
151-
issue = github.issues.find user, repo, issue_id
152+
issue = github.issues.get user, repo, issue_id
152153
issue.should be_a Hashie::Mash
153154
end
154155
end
@@ -163,7 +164,7 @@
163164

164165
it "should fail to retrive resource" do
165166
expect {
166-
github.issues.find user, repo, issue_id
167+
github.issues.get user, repo, issue_id
167168
}.to raise_error(Github::Error::NotFound)
168169
end
169170
end

0 commit comments

Comments
 (0)