diff --git a/lib/github_api/client/issues/labels.rb b/lib/github_api/client/issues/labels.rb index 53844c89..d759c97e 100644 --- a/lib/github_api/client/issues/labels.rb +++ b/lib/github_api/client/issues/labels.rb @@ -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 # @@ -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) @@ -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) diff --git a/spec/fixtures/issues/label.json b/spec/fixtures/issues/label.json index 8fe5d68e..10470f46 100644 --- a/spec/fixtures/issues/label.json +++ b/spec/fixtures/issues/label.json @@ -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" } diff --git a/spec/github/client/issues/labels/update_spec.rb b/spec/github/client/issues/labels/update_spec.rb index ca0043ae..2854e3c4 100644 --- a/spec/github/client/issues/labels/update_spec.rb +++ b/spec/github/client/issues/labels/update_spec.rb @@ -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