Permalink
Browse files

Added check_assignee method to Repositories

  • Loading branch information...
1 parent f8b83d8 commit 8d57dc94ee87955012ee22f409c78d949609d483 @andrew andrew committed Feb 9, 2013
Showing with 24 additions and 0 deletions.
  1. +13 −0 lib/octokit/client/repositories.rb
  2. +11 −0 spec/octokit/client/repositories_spec.rb
View
13 lib/octokit/client/repositories.rb
@@ -605,6 +605,19 @@ def repository_assignees(repo, options={})
end
alias :repo_assignees :repository_assignees
+ # Check to see if a particular user is an assignee for a repository.
+ #
+ # @param repo [String, Hash, Repository] A GitHub repository.
+ # @param assignee [String] User login to check
+ # @return [Boolean] True if assignable on project, false otherwise.
+ # @see Octokit::Client
+ # @see http://developer.github.com/v3/issues/assignees/#check-assignee
+ # @example
+ # Octokit.check_assignee('pengwynn/octokit', 'andrew')
+ def check_assignee(repo, assignee, options={})
+ boolean_from_response(:get, "repos/#{Repository.new repo}/assignees/#{assignee}", options)
+ end
+
# List watchers subscribing to notifications for a repo
#
# @param repo [String, Hash, Repository] A GitHub repository.
View
11 spec/octokit/client/repositories_spec.rb
@@ -458,6 +458,17 @@
end
+ describe ".check_assignee" do
+
+ it "checks to see if a particular user is an assignee for a repository" do
+ stub_get("/repos/pengwynn/octokit/assignees/andrew").
+ to_return(:status => 204)
+ is_assignee = @client.check_assignee("pengwynn/octokit", 'andrew')
+ expect(is_assignee).to eq(true)
+ end
+
+ end
+
describe ".subscribers" do
it "lists all the users watching the repository" do

0 comments on commit 8d57dc9

Please sign in to comment.