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
e6b3a055
Commit
e6b3a055
authored
Sep 18, 2020
by
Igor Drozdov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speed up spec/controllers/groups_controller_spec.rb
parent
334e139d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
35 deletions
+19
-35
spec/controllers/groups_controller_spec.rb
spec/controllers/groups_controller_spec.rb
+19
-35
No files found.
spec/controllers/groups_controller_spec.rb
View file @
e6b3a055
...
...
@@ -2,18 +2,18 @@
require
'spec_helper'
RSpec
.
describe
GroupsController
do
RSpec
.
describe
GroupsController
,
factory_default: :keep
do
include
ExternalAuthorizationServiceHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:group
)
{
create
(
:group
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
let
!
(
:group_member
)
{
create
(
:group_member
,
group:
group
,
user:
user
)
}
let
!
(
:owner
)
{
group
.
add_owner
(
create
(
:user
)).
user
}
let
!
(
:maintainer
)
{
group
.
add_maintainer
(
create
(
:user
)).
user
}
let
!
(
:developer
)
{
group
.
add_developer
(
create
(
:user
)).
user
}
let
!
(
:guest
)
{
group
.
add_guest
(
create
(
:user
)).
user
}
let
_it_be_with_refind
(
:group
)
{
create_default
(
:group
,
:public
)
}
let
_it_be_with_refind
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
let
_it_be
(
:user
)
{
create
(
:user
)
}
let
_it_be
(
:admin
)
{
create
(
:admin
)
}
let
_it_be
(
:group_member
)
{
create
(
:group_member
,
group:
group
,
user:
user
)
}
let
_it_be
(
:owner
)
{
group
.
add_owner
(
create
(
:user
)).
user
}
let
_it_be
(
:maintainer
)
{
group
.
add_maintainer
(
create
(
:user
)).
user
}
let
_it_be
(
:developer
)
{
group
.
add_developer
(
create
(
:user
)).
user
}
let
_it_be
(
:guest
)
{
group
.
add_guest
(
create
(
:user
)).
user
}
shared_examples
'member with ability to create subgroups'
do
it
'renders the new page'
do
...
...
@@ -57,7 +57,6 @@ RSpec.describe GroupsController do
describe
'GET #show'
do
before
do
sign_in
(
user
)
project
end
let
(
:format
)
{
:html
}
...
...
@@ -82,7 +81,6 @@ RSpec.describe GroupsController do
describe
'GET #details'
do
before
do
sign_in
(
user
)
project
end
let
(
:format
)
{
:html
}
...
...
@@ -131,12 +129,9 @@ RSpec.describe GroupsController do
end
describe
'GET #activity'
do
render_views
context
'as json'
do
before
do
sign_in
(
user
)
project
end
it
'includes events from all projects in group and subgroups'
,
:sidekiq_might_not_need_inline
do
...
...
@@ -157,10 +152,6 @@ RSpec.describe GroupsController do
end
context
'when user has no permission to see the event'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
let
(
:project_with_restricted_access
)
do
create
(
:project
,
:public
,
issues_access_level:
ProjectFeature
::
PRIVATE
,
group:
group
)
end
...
...
@@ -552,8 +543,6 @@ RSpec.describe GroupsController do
end
context
'when there is a conflicting group path'
do
render_views
let!
(
:conflict_group
)
{
create
(
:group
,
path:
SecureRandom
.
hex
(
12
)
)
}
let!
(
:old_name
)
{
group
.
name
}
...
...
@@ -794,6 +783,7 @@ RSpec.describe GroupsController do
context
'when transferring to a subgroup goes right'
do
let
(
:new_parent_group
)
{
create
(
:group
,
:public
)
}
let
(
:group
)
{
create
(
:group
,
:public
)
}
let!
(
:group_member
)
{
create
(
:group_member
,
:owner
,
group:
group
,
user:
user
)
}
let!
(
:new_parent_group_member
)
{
create
(
:group_member
,
:owner
,
group:
new_parent_group
,
user:
user
)
}
...
...
@@ -805,11 +795,8 @@ RSpec.describe GroupsController do
}
end
it
'returns a notice'
do
it
'returns a notice
and redirects to the new path
'
do
expect
(
flash
[
:notice
]).
to
eq
(
"Group '
#{
group
.
name
}
' was successfully transferred."
)
end
it
'redirects to the new path'
do
expect
(
response
).
to
redirect_to
(
"/
#{
new_parent_group
.
path
}
/
#{
group
.
path
}
"
)
end
end
...
...
@@ -826,17 +813,15 @@ RSpec.describe GroupsController do
}
end
it
'returns a notice'
do
it
'returns a notice
and redirects to the new path
'
do
expect
(
flash
[
:notice
]).
to
eq
(
"Group '
#{
group
.
name
}
' was successfully transferred."
)
end
it
'redirects to the new path'
do
expect
(
response
).
to
redirect_to
(
"/
#{
group
.
path
}
"
)
end
end
context
'When the transfer goes wrong'
do
let
(
:new_parent_group
)
{
create
(
:group
,
:public
)
}
let
(
:group
)
{
create
(
:group
,
:public
)
}
let!
(
:group_member
)
{
create
(
:group_member
,
:owner
,
group:
group
,
user:
user
)
}
let!
(
:new_parent_group_member
)
{
create
(
:group_member
,
:owner
,
group:
new_parent_group
,
user:
user
)
}
...
...
@@ -850,17 +835,15 @@ RSpec.describe GroupsController do
}
end
it
'returns an alert'
do
it
'returns an alert
and redirects to the current path
'
do
expect
(
flash
[
:alert
]).
to
eq
"Transfer failed: namespace directory cannot be moved"
end
it
'redirects to the current path'
do
expect
(
response
).
to
redirect_to
(
edit_group_path
(
group
))
end
end
context
'when the user is not allowed to transfer the group'
do
let
(
:new_parent_group
)
{
create
(
:group
,
:public
)
}
let
(
:group
)
{
create
(
:group
,
:public
)
}
let!
(
:group_member
)
{
create
(
:group_member
,
:guest
,
group:
group
,
user:
user
)
}
let!
(
:new_parent_group_member
)
{
create
(
:group_member
,
:guest
,
group:
new_parent_group
,
user:
user
)
}
...
...
@@ -879,6 +862,7 @@ RSpec.describe GroupsController do
context
'transferring when a project has container images'
do
let
(
:group
)
{
create
(
:group
,
:public
,
:nested
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
let!
(
:group_member
)
{
create
(
:group_member
,
:owner
,
group:
group
,
user:
user
)
}
before
do
...
...
@@ -979,6 +963,8 @@ RSpec.describe GroupsController do
end
context
'when there is no file available to download'
do
let
(
:admin
)
{
create
(
:admin
)
}
before
do
sign_in
(
admin
)
end
...
...
@@ -1149,9 +1135,7 @@ RSpec.describe GroupsController do
describe
"GET #activity as JSON"
do
include
DesignManagementTestHelpers
render_views
let
(
:project
)
{
create
(
:project
,
:public
,
group:
group
)
}
let
(
:other_project
)
{
create
(
:project
,
:public
,
group:
group
)
}
def
get_activity
...
...
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