Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
71c7b9be
Commit
71c7b9be
authored
Mar 24, 2020
by
Dmitry Gruzd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
De-duplicate groups_controller spec
parent
438e0332
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
63 deletions
+52
-63
.rubocop.yml
.rubocop.yml
+0
-2
ee/spec/controllers/ee/groups_controller_spec.rb
ee/spec/controllers/ee/groups_controller_spec.rb
+52
-0
ee/spec/controllers/groups_controller_spec.rb
ee/spec/controllers/groups_controller_spec.rb
+0
-61
No files found.
.rubocop.yml
View file @
71c7b9be
...
...
@@ -202,7 +202,6 @@ GitlabSecurity/PublicSend:
Gitlab/DuplicateSpecLocation
:
Exclude
:
-
ee/spec/controllers/groups_controller_spec.rb
-
ee/spec/controllers/projects/jobs_controller_spec.rb
-
ee/spec/helpers/auth_helper_spec.rb
-
ee/spec/lib/gitlab/gl_repository_spec.rb
...
...
@@ -215,7 +214,6 @@ Gitlab/DuplicateSpecLocation:
-
ee/spec/services/merge_requests/refresh_service_spec.rb
-
ee/spec/services/merge_requests/update_service_spec.rb
-
ee/spec/services/system_hooks_service_spec.rb
-
ee/spec/controllers/ee/groups_controller_spec.rb
-
ee/spec/controllers/ee/projects/jobs_controller_spec.rb
-
ee/spec/helpers/ee/auth_helper_spec.rb
-
ee/spec/lib/ee/gitlab/gl_repository_spec.rb
...
...
ee/spec/controllers/ee/groups_controller_spec.rb
View file @
71c7b9be
...
...
@@ -234,4 +234,56 @@ describe GroupsController do
end
end
end
describe
'POST #create'
do
context
'authorization'
do
it
'allows an auditor with "can_create_group" set to true to create a group'
do
sign_in
(
create
(
:user
,
:auditor
,
can_create_group:
true
))
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
(
:found
)
end
end
end
describe
'PUT #update'
do
let
(
:group
)
{
create
(
:group
)
}
context
'when max_pages_size param is specified'
do
let
(
:params
)
{
{
max_pages_size:
100
}
}
let
(
:request
)
do
post
:update
,
params:
{
id:
group
.
to_param
,
group:
params
}
end
let
(
:user
)
{
create
(
:user
)
}
before
do
stub_licensed_features
(
pages_size_limit:
true
)
group
.
add_owner
(
user
)
sign_in
(
user
)
end
context
'when user is an admin'
do
let
(
:user
)
{
create
(
:admin
)
}
it
'updates max_pages_size'
do
request
expect
(
group
.
reload
.
max_pages_size
).
to
eq
(
100
)
end
end
context
'when user is not an admin'
do
it
'does not update max_pages_size'
do
request
expect
(
group
.
reload
.
max_pages_size
).
to
eq
(
nil
)
end
end
end
end
end
ee/spec/controllers/groups_controller_spec.rb
deleted
100644 → 0
View file @
438e0332
# frozen_string_literal: true
require
'spec_helper'
describe
GroupsController
do
include
ExternalAuthorizationServiceHelpers
let
(
:user
)
{
create
(
:user
)
}
describe
'POST #create'
do
context
'authorization'
do
it
'allows an auditor with "can_create_group" set to true to create a group'
do
sign_in
(
create
(
:user
,
:auditor
,
can_create_group:
true
))
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
(
:found
)
end
end
end
describe
'PUT #update'
do
let
(
:group
)
{
create
(
:group
)
}
context
'when max_pages_size param is specified'
do
let
(
:params
)
{
{
max_pages_size:
100
}
}
let
(
:request
)
do
post
:update
,
params:
{
id:
group
.
to_param
,
group:
params
}
end
let
(
:user
)
{
create
(
:user
)
}
before
do
stub_licensed_features
(
pages_size_limit:
true
)
group
.
add_owner
(
user
)
sign_in
(
user
)
end
context
'when user is an admin'
do
let
(
:user
)
{
create
(
:admin
)
}
it
'updates max_pages_size'
do
request
expect
(
group
.
reload
.
max_pages_size
).
to
eq
(
100
)
end
end
context
'when user is not an admin'
do
it
'does not update max_pages_size'
do
request
expect
(
group
.
reload
.
max_pages_size
).
to
eq
(
nil
)
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment