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
5287cf67
Commit
5287cf67
authored
Aug 23, 2020
by
Igor Drozdov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create project-feature in project factory
It'll avoid an update after the factory created
parent
ba6c21a0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
5 deletions
+10
-5
spec/factories/projects.rb
spec/factories/projects.rb
+4
-2
spec/requests/projects/metrics_dashboard_spec.rb
spec/requests/projects/metrics_dashboard_spec.rb
+4
-3
spec/services/projects/overwrite_project_service_spec.rb
spec/services/projects/overwrite_project_service_spec.rb
+2
-0
No files found.
spec/factories/projects.rb
View file @
5287cf67
...
...
@@ -40,7 +40,7 @@ FactoryBot.define do
forward_deployment_enabled
{
nil
}
end
after
(
:create
)
do
|
project
,
evaluator
|
before
(
:create
)
do
|
project
,
evaluator
|
# Builds and MRs can't have higher visibility level than repository access level.
builds_access_level
=
[
evaluator
.
builds_access_level
,
evaluator
.
repository_access_level
].
min
merge_requests_access_level
=
[
evaluator
.
merge_requests_access_level
,
evaluator
.
repository_access_level
].
min
...
...
@@ -56,8 +56,10 @@ FactoryBot.define do
pages_access_level:
evaluator
.
pages_access_level
}
project
.
project_feature
.
update!
(
hash
)
project
.
build_project_feature
(
hash
)
end
after
(
:create
)
do
|
project
,
evaluator
|
# Normally the class Projects::CreateService is used for creating
# projects, and this class takes care of making sure the owner and current
# user have access to the project. Our specs don't use said service class,
...
...
spec/requests/projects/metrics_dashboard_spec.rb
View file @
5287cf67
...
...
@@ -38,16 +38,17 @@ RSpec.describe 'Projects::MetricsDashboardController' do
context
'with anonymous user and public dashboard visibility'
do
let
(
:anonymous_user
)
{
create
(
:user
)
}
let
(
:project
)
do
create
(
:project
,
:public
,
metrics_dashboard_access_level:
'enabled'
)
end
let
(
:project
)
{
create
(
:project
,
:public
)
}
before
do
project
.
update!
(
metrics_dashboard_access_level:
'enabled'
)
login_as
(
anonymous_user
)
end
it
'returns 200'
do
send_request
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
...
...
spec/services/projects/overwrite_project_service_spec.rb
View file @
5287cf67
...
...
@@ -16,6 +16,8 @@ RSpec.describe Projects::OverwriteProjectService do
subject
{
described_class
.
new
(
project_to
,
user
)
}
before
do
project_to
.
project_feature
.
reload
allow
(
project_to
).
to
receive
(
:import_data
).
and_return
(
double
(
data:
{
'original_path'
=>
project_from
.
path
}))
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