2019-12-26 22:10:19 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe API::GroupBoards do
|
2020-03-09 13:42:32 +05:30
|
|
|
let_it_be(:user) { create(:user) }
|
|
|
|
let_it_be(:non_member) { create(:user) }
|
|
|
|
let_it_be(:guest) { create(:user) }
|
|
|
|
let_it_be(:admin) { create(:user, :admin) }
|
|
|
|
let_it_be(:board_parent) { create(:group, :public) }
|
2018-03-27 19:54:05 +05:30
|
|
|
|
|
|
|
before do
|
|
|
|
board_parent.add_owner(user)
|
|
|
|
end
|
|
|
|
|
2020-03-09 13:42:32 +05:30
|
|
|
let_it_be(:project) { create(:project, :public, namespace: board_parent ) }
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2020-03-09 13:42:32 +05:30
|
|
|
let_it_be(:dev_label) do
|
2018-03-27 19:54:05 +05:30
|
|
|
create(:group_label, title: 'Development', color: '#FFAABB', group: board_parent)
|
|
|
|
end
|
|
|
|
|
2020-03-09 13:42:32 +05:30
|
|
|
let_it_be(:test_label) do
|
2018-03-27 19:54:05 +05:30
|
|
|
create(:group_label, title: 'Testing', color: '#FFAACC', group: board_parent)
|
|
|
|
end
|
|
|
|
|
2020-03-09 13:42:32 +05:30
|
|
|
let_it_be(:ux_label) do
|
2018-03-27 19:54:05 +05:30
|
|
|
create(:group_label, title: 'UX', color: '#FF0000', group: board_parent)
|
|
|
|
end
|
|
|
|
|
2020-03-09 13:42:32 +05:30
|
|
|
let_it_be(:dev_list) do
|
2018-03-27 19:54:05 +05:30
|
|
|
create(:list, label: dev_label, position: 1)
|
|
|
|
end
|
|
|
|
|
2020-03-09 13:42:32 +05:30
|
|
|
let_it_be(:test_list) do
|
2018-03-27 19:54:05 +05:30
|
|
|
create(:list, label: test_label, position: 2)
|
|
|
|
end
|
|
|
|
|
2020-03-09 13:42:32 +05:30
|
|
|
let_it_be(:milestone) { create(:milestone, group: board_parent) }
|
|
|
|
let_it_be(:board_label) { create(:group_label, group: board_parent) }
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2020-03-09 13:42:32 +05:30
|
|
|
let_it_be(:board) { create(:board, group: board_parent, lists: [dev_list, test_list]) }
|
2018-03-27 19:54:05 +05:30
|
|
|
|
|
|
|
it_behaves_like 'group and project boards', "/groups/:id/boards", false
|
|
|
|
|
|
|
|
describe 'POST /groups/:id/boards/lists' do
|
|
|
|
let(:url) { "/groups/#{board_parent.id}/boards/#{board.id}/lists" }
|
|
|
|
|
|
|
|
it 'does not create lists for child project labels' do
|
|
|
|
project_label = create(:label, project: project)
|
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
post api(url, user), params: { label_id: project_label.id }
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
expect(response).to have_gitlab_http_status(:bad_request)
|
2018-03-27 19:54:05 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|