debian-mirror-gitlab/spec/frontend/fixtures/labels.rb

78 lines
2 KiB
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
require 'spec_helper'
describe 'Labels (JavaScript fixtures)' do
include JavaScriptFixturesHelpers
let(:admin) { create(:admin) }
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') }
before(:all) do
clean_frontend_fixtures('labels/')
end
2018-03-17 18:26:18 +05:30
after do
remove_repository(project)
end
2017-08-17 22:00:37 +05:30
describe Groups::LabelsController, '(JavaScript fixtures)', type: :controller do
render_views
2018-03-17 18:26:18 +05:30
before do
2017-08-17 22:00:37 +05:30
sign_in(admin)
end
2019-09-04 21:01:54 +05:30
it 'labels/group_labels.json' do
2019-02-15 15:39:39 +05:30
get :index, params: {
group_id: group
}, format: 'json'
2017-08-17 22:00:37 +05:30
2019-10-12 21:52:04 +05:30
expect(response).to be_successful
2017-08-17 22:00:37 +05:30
end
end
2020-04-08 14:13:33 +05:30
describe API::Helpers::LabelHelpers, type: :request do
include JavaScriptFixturesHelpers
include ApiHelpers
let(:user) { create(:user) }
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-08-17 22:00:37 +05:30
describe Projects::LabelsController, '(JavaScript fixtures)', type: :controller do
render_views
2018-03-17 18:26:18 +05:30
before do
2017-08-17 22:00:37 +05:30
sign_in(admin)
end
2019-09-04 21:01:54 +05:30
it 'labels/project_labels.json' do
2019-02-15 15:39:39 +05:30
get :index, params: {
2017-08-17 22:00:37 +05:30
namespace_id: group,
2019-02-15 15:39:39 +05:30
project_id: project
}, format: 'json'
2017-08-17 22:00:37 +05:30
2019-10-12 21:52:04 +05:30
expect(response).to be_successful
2017-08-17 22:00:37 +05:30
end
end
end