diff options
author | Rémy Coutable <remy@rymai.me> | 2017-07-25 19:09:00 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-07-27 14:31:53 +0200 |
commit | cddc5cacfb833fbd188d2f5982381f66dd3eee3b (patch) | |
tree | de3e7bda37c8b7f0eb5586695d6d871484dc44e2 /spec/services/labels | |
parent | ddccd24c1388dadc057ac3c4c0a49f3fea847292 (diff) | |
download | gitlab-ce-cddc5cacfb833fbd188d2f5982381f66dd3eee3b.tar.gz |
Use described_class when possible
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/services/labels')
-rw-r--r-- | spec/services/labels/create_service_spec.rb | 36 | ||||
-rw-r--r-- | spec/services/labels/update_service_spec.rb | 12 |
2 files changed, 24 insertions, 24 deletions
diff --git a/spec/services/labels/create_service_spec.rb b/spec/services/labels/create_service_spec.rb index 0fa7b5199fe..ecb88653001 100644 --- a/spec/services/labels/create_service_spec.rb +++ b/spec/services/labels/create_service_spec.rb @@ -17,7 +17,7 @@ describe Labels::CreateService do context 'in a project' do context 'with color in hex-code' do it 'creates a label' do - label = Labels::CreateService.new(params_with(hex_color)).execute(project: project) + label = described_class.new(params_with(hex_color)).execute(project: project) expect(label).to be_persisted expect(label.color).to eq expected_saved_color @@ -26,7 +26,7 @@ describe Labels::CreateService do context 'with color in allowed name' do it 'creates a label' do - label = Labels::CreateService.new(params_with(named_color)).execute(project: project) + label = described_class.new(params_with(named_color)).execute(project: project) expect(label).to be_persisted expect(label.color).to eq expected_saved_color @@ -35,7 +35,7 @@ describe Labels::CreateService do context 'with color in up-case allowed name' do it 'creates a label' do - label = Labels::CreateService.new(params_with(upcase_color)).execute(project: project) + label = described_class.new(params_with(upcase_color)).execute(project: project) expect(label).to be_persisted expect(label.color).to eq expected_saved_color @@ -44,7 +44,7 @@ describe Labels::CreateService do context 'with color surrounded by spaces' do it 'creates a label' do - label = Labels::CreateService.new(params_with(spaced_color)).execute(project: project) + label = described_class.new(params_with(spaced_color)).execute(project: project) expect(label).to be_persisted expect(label.color).to eq expected_saved_color @@ -53,7 +53,7 @@ describe Labels::CreateService do context 'with unknown color' do it 'doesn\'t create a label' do - label = Labels::CreateService.new(params_with(unknown_color)).execute(project: project) + label = described_class.new(params_with(unknown_color)).execute(project: project) expect(label).not_to be_persisted end @@ -61,7 +61,7 @@ describe Labels::CreateService do context 'with no color' do it 'doesn\'t create a label' do - label = Labels::CreateService.new(params_with(no_color)).execute(project: project) + label = described_class.new(params_with(no_color)).execute(project: project) expect(label).not_to be_persisted end @@ -71,7 +71,7 @@ describe Labels::CreateService do context 'in a group' do context 'with color in hex-code' do it 'creates a label' do - label = Labels::CreateService.new(params_with(hex_color)).execute(group: group) + label = described_class.new(params_with(hex_color)).execute(group: group) expect(label).to be_persisted expect(label.color).to eq expected_saved_color @@ -80,7 +80,7 @@ describe Labels::CreateService do context 'with color in allowed name' do it 'creates a label' do - label = Labels::CreateService.new(params_with(named_color)).execute(group: group) + label = described_class.new(params_with(named_color)).execute(group: group) expect(label).to be_persisted expect(label.color).to eq expected_saved_color @@ -89,7 +89,7 @@ describe Labels::CreateService do context 'with color in up-case allowed name' do it 'creates a label' do - label = Labels::CreateService.new(params_with(upcase_color)).execute(group: group) + label = described_class.new(params_with(upcase_color)).execute(group: group) expect(label).to be_persisted expect(label.color).to eq expected_saved_color @@ -98,7 +98,7 @@ describe Labels::CreateService do context 'with color surrounded by spaces' do it 'creates a label' do - label = Labels::CreateService.new(params_with(spaced_color)).execute(group: group) + label = described_class.new(params_with(spaced_color)).execute(group: group) expect(label).to be_persisted expect(label.color).to eq expected_saved_color @@ -107,7 +107,7 @@ describe Labels::CreateService do context 'with unknown color' do it 'doesn\'t create a label' do - label = Labels::CreateService.new(params_with(unknown_color)).execute(group: group) + label = described_class.new(params_with(unknown_color)).execute(group: group) expect(label).not_to be_persisted end @@ -115,7 +115,7 @@ describe Labels::CreateService do context 'with no color' do it 'doesn\'t create a label' do - label = Labels::CreateService.new(params_with(no_color)).execute(group: group) + label = described_class.new(params_with(no_color)).execute(group: group) expect(label).not_to be_persisted end @@ -125,7 +125,7 @@ describe Labels::CreateService do context 'in admin area' do context 'with color in hex-code' do it 'creates a label' do - label = Labels::CreateService.new(params_with(hex_color)).execute(template: true) + label = described_class.new(params_with(hex_color)).execute(template: true) expect(label).to be_persisted expect(label.color).to eq expected_saved_color @@ -134,7 +134,7 @@ describe Labels::CreateService do context 'with color in allowed name' do it 'creates a label' do - label = Labels::CreateService.new(params_with(named_color)).execute(template: true) + label = described_class.new(params_with(named_color)).execute(template: true) expect(label).to be_persisted expect(label.color).to eq expected_saved_color @@ -143,7 +143,7 @@ describe Labels::CreateService do context 'with color in up-case allowed name' do it 'creates a label' do - label = Labels::CreateService.new(params_with(upcase_color)).execute(template: true) + label = described_class.new(params_with(upcase_color)).execute(template: true) expect(label).to be_persisted expect(label.color).to eq expected_saved_color @@ -152,7 +152,7 @@ describe Labels::CreateService do context 'with color surrounded by spaces' do it 'creates a label' do - label = Labels::CreateService.new(params_with(spaced_color)).execute(template: true) + label = described_class.new(params_with(spaced_color)).execute(template: true) expect(label).to be_persisted expect(label.color).to eq expected_saved_color @@ -161,7 +161,7 @@ describe Labels::CreateService do context 'with unknown color' do it 'doesn\'t create a label' do - label = Labels::CreateService.new(params_with(unknown_color)).execute(template: true) + label = described_class.new(params_with(unknown_color)).execute(template: true) expect(label).not_to be_persisted end @@ -169,7 +169,7 @@ describe Labels::CreateService do context 'with no color' do it 'doesn\'t create a label' do - label = Labels::CreateService.new(params_with(no_color)).execute(template: true) + label = described_class.new(params_with(no_color)).execute(template: true) expect(label).not_to be_persisted end diff --git a/spec/services/labels/update_service_spec.rb b/spec/services/labels/update_service_spec.rb index 83ea11f62a6..bb95fe20fbf 100644 --- a/spec/services/labels/update_service_spec.rb +++ b/spec/services/labels/update_service_spec.rb @@ -20,7 +20,7 @@ describe Labels::UpdateService do context 'with color in hex-code' do it 'updates the label' do - label = Labels::UpdateService.new(params_with(hex_color)).execute(@label) + label = described_class.new(params_with(hex_color)).execute(@label) expect(label).to be_valid expect(label.reload.color).to eq expected_saved_color @@ -29,7 +29,7 @@ describe Labels::UpdateService do context 'with color in allowed name' do it 'updates the label' do - label = Labels::UpdateService.new(params_with(named_color)).execute(@label) + label = described_class.new(params_with(named_color)).execute(@label) expect(label).to be_valid expect(label.reload.color).to eq expected_saved_color @@ -38,7 +38,7 @@ describe Labels::UpdateService do context 'with color in up-case allowed name' do it 'updates the label' do - label = Labels::UpdateService.new(params_with(upcase_color)).execute(@label) + label = described_class.new(params_with(upcase_color)).execute(@label) expect(label).to be_valid expect(label.reload.color).to eq expected_saved_color @@ -47,7 +47,7 @@ describe Labels::UpdateService do context 'with color surrounded by spaces' do it 'updates the label' do - label = Labels::UpdateService.new(params_with(spaced_color)).execute(@label) + label = described_class.new(params_with(spaced_color)).execute(@label) expect(label).to be_valid expect(label.reload.color).to eq expected_saved_color @@ -56,7 +56,7 @@ describe Labels::UpdateService do context 'with unknown color' do it 'doesn\'t update the label' do - label = Labels::UpdateService.new(params_with(unknown_color)).execute(@label) + label = described_class.new(params_with(unknown_color)).execute(@label) expect(label).not_to be_valid end @@ -64,7 +64,7 @@ describe Labels::UpdateService do context 'with no color' do it 'doesn\'t update the label' do - label = Labels::UpdateService.new(params_with(no_color)).execute(@label) + label = described_class.new(params_with(no_color)).execute(@label) expect(label).not_to be_valid end |