From b9cb49ad45e412d3330393d41b943c7b2957aefc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C5=82gorzata=20Ksionek?= Date: Mon, 3 Jun 2019 09:32:12 +0200 Subject: [PATCH] Move specs to ce directory --- spec/controllers/groups_controller_spec.rb | 22 ++++++++++++++++++++ spec/controllers/projects_controller_spec.rb | 12 +++++++++++ 2 files changed, 34 insertions(+) diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb index 1cd08200552..47d7e278183 100644 --- a/spec/controllers/groups_controller_spec.rb +++ b/spec/controllers/groups_controller_spec.rb @@ -141,6 +141,28 @@ describe GroupsController do end describe 'POST #create' do + it 'allows creating a group' do + sign_in(user) + + expect do + post :create, params: { group: { name: 'new_group', path: "new_group" } } + end.to change { Group.count }.by(1) + + expect(response).to have_gitlab_http_status(302) + end + + context 'authorization' do + it 'allows an admin to create a group' do + sign_in(create(:admin)) + + expect do + post :create, params: { group: { name: 'new_group', path: "new_group" } } + end.to change { Group.count }.by(1) + + expect(response).to have_gitlab_http_status(302) + end + end + context 'when creating subgroups', :nested_groups do [true, false].each do |can_create_group_status| context "and can_create_group is #{can_create_group_status}" do diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index 7f1bbebd128..8d2412f97ef 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -292,6 +292,18 @@ describe ProjectsController do end describe 'GET edit' do + it 'allows an admin user to access the page' do + sign_in(create(:user, :admin)) + + get :edit, + params: { + namespace_id: project.namespace.path, + id: project.path + } + + expect(response).to have_gitlab_http_status(200) + end + it 'sets the badge API endpoint' do sign_in(user) project.add_maintainer(user)