2019-10-17 02:07:30 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-05-05 18:47:32 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-16 14:09:01 -04:00
|
|
|
RSpec.describe 'Labels (JavaScript fixtures)' do
|
2017-05-05 18:47:32 -04:00
|
|
|
include JavaScriptFixturesHelpers
|
|
|
|
|
2020-12-07 07:10:00 -05:00
|
|
|
let(:user) { create(:user) }
|
2017-05-05 18:47:32 -04:00
|
|
|
let(:group) { create(:group, name: 'frontend-fixtures-group' )}
|
|
|
|
let(:project) { create(:project_empty_repo, namespace: group, path: 'labels-project') }
|
|
|
|
|
|
|
|
let!(:project_label_bug) { create(:label, project: project, title: 'bug', color: '#FF0000') }
|
|
|
|
let!(:project_label_enhancement) { create(:label, project: project, title: 'enhancement', color: '#00FF00') }
|
|
|
|
let!(:project_label_feature) { create(:label, project: project, title: 'feature', color: '#0000FF') }
|
|
|
|
|
|
|
|
let!(:group_label_roses) { create(:group_label, group: group, title: 'roses', color: '#FF0000') }
|
|
|
|
let!(:groub_label_space) { create(:group_label, group: group, title: 'some space', color: '#FFFFFF') }
|
|
|
|
let!(:groub_label_violets) { create(:group_label, group: group, title: 'violets', color: '#0000FF') }
|
|
|
|
|
2017-08-22 19:19:35 -04:00
|
|
|
after do
|
|
|
|
remove_repository(project)
|
|
|
|
end
|
|
|
|
|
2020-02-25 04:09:10 -05:00
|
|
|
describe API::Helpers::LabelHelpers, type: :request do
|
|
|
|
include JavaScriptFixturesHelpers
|
|
|
|
include ApiHelpers
|
|
|
|
|
|
|
|
before do
|
|
|
|
group.add_owner(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'api/group_labels.json' do
|
|
|
|
get api("/groups/#{group.id}/labels", user)
|
|
|
|
|
|
|
|
expect(response).to be_successful
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-05-05 18:47:32 -04:00
|
|
|
describe Projects::LabelsController, '(JavaScript fixtures)', type: :controller do
|
|
|
|
render_views
|
|
|
|
|
2017-08-10 18:31:42 -04:00
|
|
|
before do
|
2020-12-07 07:10:00 -05:00
|
|
|
group.add_owner(user)
|
|
|
|
sign_in(user)
|
2017-05-05 18:47:32 -04:00
|
|
|
end
|
|
|
|
|
2019-04-21 06:58:07 -04:00
|
|
|
it 'labels/project_labels.json' do
|
2018-12-19 14:50:20 -05:00
|
|
|
get :index, params: {
|
2017-05-05 18:47:32 -04:00
|
|
|
namespace_id: group,
|
2018-12-19 14:50:20 -05:00
|
|
|
project_id: project
|
|
|
|
}, format: 'json'
|
2017-05-05 18:47:32 -04:00
|
|
|
|
2019-07-17 18:15:53 -04:00
|
|
|
expect(response).to be_successful
|
2017-05-05 18:47:32 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|