Skip to content

Loading…

Added check_assignee method to Repositories #218

Merged
merged 1 commit into from

2 participants

@pengwynn
octokit member

:guitar:

@pengwynn pengwynn merged commit 75904d2 into octokit:master

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
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
Something went wrong with that request. Please try again.