2017-07-07 08:54:49 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Dashboard::LabelsController do
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project) { create(:project) }
|
2017-07-07 08:54:49 -04:00
|
|
|
let(:user) { create(:user) }
|
|
|
|
let!(:label) { create(:label, project: project) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
project.add_reporter(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "#index" do
|
2017-08-02 15:55:11 -04:00
|
|
|
let!(:unrelated_label) { create(:label, project: create(:project, :public)) }
|
2017-07-07 08:54:49 -04:00
|
|
|
|
2019-04-09 11:38:58 -04:00
|
|
|
subject { get :index, format: :json }
|
|
|
|
|
2017-07-07 08:54:49 -04:00
|
|
|
it 'returns global labels for projects the user has a relationship with' do
|
2019-04-09 11:38:58 -04:00
|
|
|
subject
|
2017-07-07 08:54:49 -04:00
|
|
|
|
|
|
|
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-04-09 11:38:58 -04:00
|
|
|
|
|
|
|
it_behaves_like 'disabled when using an external authorization service'
|
2017-07-07 08:54:49 -04:00
|
|
|
end
|
|
|
|
end
|