debian-mirror-gitlab/spec/controllers/dashboard/labels_controller_spec.rb

32 lines
829 B
Ruby
Raw Normal View History

2019-07-31 22:56:46 +05:30
# frozen_string_literal: true
2017-09-10 17:25:29 +05:30
require 'spec_helper'
2020-06-23 00:09:42 +05:30
RSpec.describe Dashboard::LabelsController do
2017-09-10 17:25:29 +05:30
let(:project) { create(:project) }
let(:user) { create(:user) }
let!(:label) { create(:label, project: project) }
before do
sign_in(user)
project.add_reporter(user)
end
describe "#index" do
let!(:unrelated_label) { create(:label, project: create(:project, :public)) }
2019-07-07 11:18:12 +05:30
subject { get :index, format: :json }
2017-09-10 17:25:29 +05:30
it 'returns global labels for projects the user has a relationship with' do
2019-07-07 11:18:12 +05:30
subject
2017-09-10 17:25:29 +05:30
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)
end
2019-07-07 11:18:12 +05:30
it_behaves_like 'disabled when using an external authorization service'
2017-09-10 17:25:29 +05:30
end
end