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

Allow changing labels description #373

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
5 changes: 2 additions & 3 deletions lib/github_api/client/issues/labels.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module Github
class Client::Issues::Labels < API

VALID_LABEL_INPUTS = %w[ name color ].freeze
VALID_LABEL_INPUTS = %w[ name color description new_name ].freeze

# List all labels for a repository
#
Expand Down Expand Up @@ -80,7 +80,7 @@ def get(*args)
def create(*args)
arguments(args, required: [:user, :repo]) do
permit VALID_LABEL_INPUTS
assert_required VALID_LABEL_INPUTS
assert_required %w[ name color ]
end

post_request("/repos/#{arguments.user}/#{arguments.repo}/labels", arguments.params)
Expand All @@ -103,7 +103,6 @@ def create(*args)
def update(*args)
arguments(args, required: [:user, :repo, :label_name]) do
permit VALID_LABEL_INPUTS
assert_required VALID_LABEL_INPUTS
end

patch_request("/repos/#{arguments.user}/#{arguments.repo}/labels/#{arguments.label_name}", arguments.params)
Expand Down
3 changes: 2 additions & 1 deletion spec/fixtures/issues/label.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
"name": "bug",
"color": "f29513"
"color": "f29513",
"description": "Something isn't working"
}
12 changes: 0 additions & 12 deletions spec/github/client/issues/labels/update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,6 @@
let(:body) { fixture('issues/label.json') }
let(:status) { 200 }

it "should fail to create resource if 'name' input is missing" do
expect {
subject.update user, repo, label_id, inputs.except('name')
}.to raise_error(Github::Error::RequiredParams)
end

it "should fail to create resource if 'color' input is missing" do
expect {
subject.update user, repo, label_id, inputs.except('color')
}.to raise_error(Github::Error::RequiredParams)
end

it "should update resource successfully" do
subject.update user, repo, label_id, inputs
expect(a_patch(request_path).with(body: inputs)).to have_been_made
Expand Down