Merge branch 'issue-6568-single-codebase-spec-controllers' into 'master'

single codebase spec controllers

See merge request gitlab-org/gitlab-ce!29041
This commit is contained in:
Lin Jen-Shin 2019-06-05 09:58:16 +00:00
commit 879f002221
2 changed files with 34 additions and 0 deletions

View File

@ -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

View File

@ -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)