diff options
author | Patrick Derichs <pderichs@gitlab.com> | 2019-08-23 20:45:42 +0300 |
---|---|---|
committer | Kamil TrzciĆski <ayufan@ayufan.eu> | 2019-08-23 20:45:42 +0300 |
commit | f1e24d4d31776f675cd4a7cdc21ddc9d496400cf (patch) | |
tree | f756ce1ffa010d289165e1b6bbed4cd41c3da59c /spec/lib/api/helpers | |
parent | e84922906e51b22f2f335ebaa4390ccac2e4caf8 (diff) |
Add label_id parameter to label API for PUT and DELETE
Add specs for new parameter and updated documentation as well.
Diffstat (limited to 'spec/lib/api/helpers')
-rw-r--r-- | spec/lib/api/helpers/label_helpers_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/lib/api/helpers/label_helpers_spec.rb b/spec/lib/api/helpers/label_helpers_spec.rb new file mode 100644 index 00000000000..138e9a22d70 --- /dev/null +++ b/spec/lib/api/helpers/label_helpers_spec.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe API::Helpers::LabelHelpers do + describe 'create_service_params' do + let(:label_helper) do + Class.new do + include API::Helpers::LabelHelpers + end.new + end + + context 'when a project is given' do + it 'returns the expected params' do + project = create(:project) + expect(label_helper.create_service_params(project)).to eq({ project: project }) + end + end + + context 'when a group is given' do + it 'returns the expected params' do + group = create(:group) + expect(label_helper.create_service_params(group)).to eq({ group: group }) + end + end + + context 'when something else is given' do + it 'raises a type error' do + expect { label_helper.create_service_params(Class.new) }.to raise_error(TypeError) + end + end + end +end |