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
9cb9dc40
Commit
9cb9dc40
authored
Sep 11, 2017
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix broken spec
parent
f467ad2b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
44 deletions
+32
-44
spec/controllers/groups_controller_spec.rb
spec/controllers/groups_controller_spec.rb
+32
-44
No files found.
spec/controllers/groups_controller_spec.rb
View file @
9cb9dc40
...
@@ -61,6 +61,38 @@ describe GroupsController do
...
@@ -61,6 +61,38 @@ describe GroupsController do
end
end
describe
'POST #create'
do
describe
'POST #create'
do
it
'allows creating a group'
do
sign_in
(
user
)
expect
do
post
:create
,
group:
{
name:
'new_group'
,
path:
"new_group"
}
end
.
to
change
{
Group
.
count
}.
by
(
1
)
expect
(
response
).
to
have_http_status
(
302
)
end
context
'authorization'
do
it
'allows an admin to create a group'
do
sign_in
(
create
(
:admin
))
expect
do
post
:create
,
group:
{
name:
'new_group'
,
path:
"new_group"
}
end
.
to
change
{
Group
.
count
}.
by
(
1
)
expect
(
response
).
to
have_http_status
(
302
)
end
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
,
group:
{
name:
'new_group'
,
path:
"new_group"
}
end
.
to
change
{
Group
.
count
}.
by
(
1
)
expect
(
response
).
to
have_http_status
(
302
)
end
end
context
'when creating subgroups'
,
:nested_groups
do
context
'when creating subgroups'
,
:nested_groups
do
[
true
,
false
].
each
do
|
can_create_group_status
|
[
true
,
false
].
each
do
|
can_create_group_status
|
context
"and can_create_group is
#{
can_create_group_status
}
"
do
context
"and can_create_group is
#{
can_create_group_status
}
"
do
...
@@ -287,50 +319,6 @@ describe GroupsController do
...
@@ -287,50 +319,6 @@ describe GroupsController do
end
end
end
end
describe
'POST create'
do
it
'allows creating a group'
do
sign_in
(
user
)
expect
do
post
:create
,
group:
{
name:
'new_group'
,
path:
"new_group"
}
end
.
to
change
{
Group
.
count
}.
by
(
1
)
expect
(
response
).
to
have_http_status
(
302
)
end
context
'authorization'
do
it
'allows an admin to create a group'
do
sign_in
(
create
(
:admin
))
expect
do
post
:create
,
group:
{
name:
'new_group'
,
path:
"new_group"
}
end
.
to
change
{
Group
.
count
}.
by
(
1
)
expect
(
response
).
to
have_http_status
(
302
)
end
it
'does not allow a user with "can_create_group" set to false to create a group'
do
sign_in
(
create
(
:user
,
can_create_group:
false
))
expect
do
post
:create
,
group:
{
name:
'new_group'
,
path:
"new_group"
}
end
.
not_to
change
{
Group
.
count
}
expect
(
response
).
to
have_http_status
(
404
)
end
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
,
group:
{
name:
'new_group'
,
path:
"new_group"
}
end
.
to
change
{
Group
.
count
}.
by
(
1
)
expect
(
response
).
to
have_http_status
(
302
)
end
end
end
describe
'#ensure_canonical_path'
do
describe
'#ensure_canonical_path'
do
before
do
before
do
sign_in
(
user
)
sign_in
(
user
)
...
...
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