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
f050000d
Commit
f050000d
authored
Oct 26, 2020
by
drew cimino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dry up some FactoryBot usage with let_it_be
parent
4ba00f14
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
15 deletions
+12
-15
ee/spec/controllers/projects_controller_spec.rb
ee/spec/controllers/projects_controller_spec.rb
+12
-15
No files found.
ee/spec/controllers/projects_controller_spec.rb
View file @
f050000d
...
...
@@ -3,17 +3,19 @@
require
'spec_helper'
RSpec
.
describe
ProjectsController
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:public_project
)
{
create
(
:project
,
:public
,
:repository
)
}
before
do
project
.
add_maintainer
(
user
)
sign_in
(
user
)
end
describe
"GET show"
do
let
(
:public_project
)
{
create
(
:project
,
:public
,
:repository
)
}
describe
'GET show'
do
render_views
subject
{
get
:show
,
params:
{
namespace_id:
public_project
.
namespace
.
path
,
id:
public_project
.
path
}
}
...
...
@@ -102,7 +104,6 @@ RSpec.describe ProjectsController do
end
context
'custom project templates'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:project_template
)
{
create
(
:project
,
:repository
,
:public
,
:metrics_dashboard_enabled
,
namespace:
group
)
}
let
(
:templates_params
)
do
{
...
...
@@ -446,7 +447,6 @@ RSpec.describe ProjectsController do
end
context
'Archive & Unarchive actions'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
let
(
:archived_project
)
{
create
(
:project
,
:archived
,
group:
group
)
}
...
...
@@ -502,14 +502,12 @@ RSpec.describe ProjectsController do
end
describe
'DELETE #destroy'
do
let
(
:owner
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
group:
group
)}
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
before
do
group
.
add_user
(
own
er
,
Gitlab
::
Access
::
OWNER
)
group
.
add_user
(
us
er
,
Gitlab
::
Access
::
OWNER
)
controller
.
instance_variable_set
(
:@project
,
project
)
sign_in
(
own
er
)
sign_in
(
us
er
)
end
shared_examples
'deletes project right away'
do
...
...
@@ -578,7 +576,7 @@ RSpec.describe ProjectsController do
end
context
'for projects in user namespace'
do
let
(
:project
)
{
create
(
:project
,
namespace:
owner
.
namespace
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
it_behaves_like
'deletes project right away'
end
...
...
@@ -594,12 +592,11 @@ RSpec.describe ProjectsController do
end
describe
'POST #restore'
do
let
(
:owner
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
owner
.
namespace
)}
let
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
before
do
controller
.
instance_variable_set
(
:@project
,
project
)
sign_in
(
own
er
)
sign_in
(
us
er
)
end
it
'restores project deletion'
do
...
...
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