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
149da90b
Commit
149da90b
authored
Mar 09, 2021
by
Samantha Ming
Committed by
Mark Lapierre
Mar 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split fork spec into FF enable or disable
Part of issue:
https://gitlab.com/gitlab-org/gitlab/-/issues/15013
parent
2dc5ffc1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
143 additions
and
128 deletions
+143
-128
spec/features/projects/fork_spec.rb
spec/features/projects/fork_spec.rb
+143
-128
No files found.
spec/features/projects/fork_spec.rb
View file @
149da90b
...
...
@@ -9,10 +9,10 @@ RSpec.describe 'Project fork' do
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
before
do
stub_feature_flags
(
fork_project_form:
false
)
sign_in
(
user
)
end
shared_examples
'fork button on project page'
do
it
'allows user to fork project from the project page'
do
visit
project_path
(
project
)
...
...
@@ -29,29 +29,10 @@ RSpec.describe 'Project fork' do
expect
(
page
).
to
have_css
(
'a.disabled'
,
text:
'Fork'
)
end
context
'with a group to fork to'
do
let!
(
:group
)
{
create
(
:group
).
tap
{
|
group
|
group
.
add_owner
(
user
)
}
}
it
'enables fork button on project page'
do
visit
project_path
(
project
)
expect
(
page
).
not_to
have_css
(
'a.disabled'
,
text:
'Fork'
)
end
it
'allows user to fork only to the group on fork page'
,
:js
do
visit
new_project_fork_path
(
project
)
to_personal_namespace
=
find
(
'[data-qa-selector=fork_namespace_button].disabled'
)
to_group
=
find
(
".fork-groups button[data-qa-name=
#{
group
.
name
}
]"
)
expect
(
to_personal_namespace
).
not_to
be_nil
expect
(
to_group
).
not_to
be_disabled
end
end
end
context
'forking enabled / disabled in project settings'
do
shared_examples
'create fork page'
do
|
fork_page_text
|
before
do
project
.
project_feature
.
update_attribute
(
:forking_access_level
,
forking_access_level
)
...
...
@@ -71,7 +52,7 @@ RSpec.describe 'Project fork' do
visit
new_project_fork_path
(
project
)
expect
(
page
.
status_code
).
to
eq
(
200
)
expect
(
page
).
to
have_text
(
' Select a namespace to fork the project '
)
expect
(
page
).
to
have_text
(
fork_page_text
)
end
end
...
...
@@ -128,12 +109,45 @@ RSpec.describe 'Project fork' do
visit
new_project_fork_path
(
project
)
expect
(
page
.
status_code
).
to
eq
(
200
)
expect
(
page
).
to
have_text
(
' Select a namespace to fork the project '
)
expect
(
page
).
to
have_text
(
fork_page_text
)
end
end
end
end
it_behaves_like
'fork button on project page'
it_behaves_like
'create fork page'
,
'Fork project'
context
'with fork_project_form feature flag disabled'
do
before
do
stub_feature_flags
(
fork_project_form:
false
)
sign_in
(
user
)
end
it_behaves_like
'fork button on project page'
context
'user has exceeded personal project limit'
do
before
do
user
.
update!
(
projects_limit:
0
)
end
context
'with a group to fork to'
do
let!
(
:group
)
{
create
(
:group
).
tap
{
|
group
|
group
.
add_owner
(
user
)
}
}
it
'allows user to fork only to the group on fork page'
,
:js
do
visit
new_project_fork_path
(
project
)
to_personal_namespace
=
find
(
'[data-qa-selector=fork_namespace_button].disabled'
)
to_group
=
find
(
".fork-groups button[data-qa-name=
#{
group
.
name
}
]"
)
expect
(
to_personal_namespace
).
not_to
be_nil
expect
(
to_group
).
not_to
be_disabled
end
end
end
it_behaves_like
'create fork page'
,
' Select a namespace to fork the project '
it
'forks the project'
,
:sidekiq_might_not_need_inline
do
visit
project_path
(
project
)
...
...
@@ -297,4 +311,5 @@ RSpec.describe 'Project fork' do
expect
(
current_path
).
to
eq
(
project_path
(
forked_project
))
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