Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added check_assignee method to Repositories #218

Merged
merged 1 commit into from
Feb 9, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib/octokit/client/repositories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 11 additions & 0 deletions spec/octokit/client/repositories_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down