diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /spec/controllers/dashboard | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'spec/controllers/dashboard')
-rw-r--r-- | spec/controllers/dashboard/labels_controller_spec.rb | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/spec/controllers/dashboard/labels_controller_spec.rb b/spec/controllers/dashboard/labels_controller_spec.rb index 415cb821545..e7091664d1a 100644 --- a/spec/controllers/dashboard/labels_controller_spec.rb +++ b/spec/controllers/dashboard/labels_controller_spec.rb @@ -3,27 +3,32 @@ require 'spec_helper' RSpec.describe Dashboard::LabelsController do - let(:project) { create(:project) } - let(:user) { create(:user) } - let!(:label) { create(:label, project: project) } + let_it_be(:user) { create(:user) } + let_it_be(:project) { create(:project) } + let_it_be(:project_2) { create(:project) } + + let_it_be(:label) { create(:label, project: project, title: 'some_label') } + let_it_be(:label_with_same_title) { create(:label, project: project_2, title: 'some_label') } + let_it_be(:unrelated_label) { create(:label, project: create(:project, :public)) } + + before_all do + project.add_reporter(user) + project_2.add_reporter(user) + end before do sign_in(user) - project.add_reporter(user) end describe "#index" do - let!(:unrelated_label) { create(:label, project: create(:project, :public)) } - subject { get :index, format: :json } - it 'returns global labels for projects the user has a relationship with' do + it 'returns labels with unique titles for projects the user has a relationship with' do subject expect(json_response).to be_kind_of(Array) expect(json_response.size).to eq(1) - expect(json_response[0]["id"]).to be_nil - expect(json_response[0]["title"]).to eq(label.title) + expect(json_response[0]['title']).to eq(label.title) end it_behaves_like 'disabled when using an external authorization service' |