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
e4558010
Commit
e4558010
authored
Mar 04, 2018
by
Semyon Pupkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move project fork spinach tests to RSpec
https://gitlab.com/gitlab-org/gitlab-ce/issues/23036
parent
8a0052c0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
104 additions
and
134 deletions
+104
-134
features/project/fork.feature
features/project/fork.feature
+0
-49
features/steps/project/fork.rb
features/steps/project/fork.rb
+0
-85
spec/features/projects/fork_spec.rb
spec/features/projects/fork_spec.rb
+104
-0
No files found.
features/project/fork.feature
deleted
100644 → 0
View file @
8a0052c0
Feature
:
Project Fork
Background
:
Given
I sign in as a user
And
I am a member of project
"Shop"
When
I visit project
"Shop"
page
Scenario
:
User fork a project
Given
I click link
"Fork"
When
I fork to my namespace
Then
I should see the forked project page
Scenario
:
User already has forked the project
Given
I already have a project named
"Shop"
in my namespace
And
I click link
"Fork"
When
I fork to my namespace
Then
I should see a
"Name has already been taken"
warning
Scenario
:
Merge request on canonical repo goes to fork merge request page
Given
I click link
"Fork"
And
I fork to my namespace
Then
I should see the forked project page
When
I visit project
"Shop"
page
Then
I should see
"New merge request"
And
I goto the Merge Requests page
Then
I should see
"New merge request"
And
I click link
"New merge request"
Then
I should see the new merge request page for my namespace
Scenario
:
Viewing forks of a Project
Given
I click link
"Fork"
When
I fork to my namespace
And
I visit the forks page of the
"Shop"
project
Then
I should see my fork on the list
Scenario
:
Viewing forks of a Project that has no repo
Given
I click link
"Fork"
When
I fork to my namespace
And
I make forked repo invalid
And
I visit the forks page of the
"Shop"
project
Then
I should see my fork on the list
Scenario
:
Viewing private forks of a Project
Given
There is an existent fork of the
"Shop"
project
And
I click link
"Fork"
When
I fork to my namespace
And
I visit the forks page of the
"Shop"
project
Then
I should see my fork on the list
And
I should not see the other fork listed
And
I should see a private fork notice
features/steps/project/fork.rb
deleted
100644 → 0
View file @
8a0052c0
class
Spinach::Features::ProjectFork
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedPaths
include
SharedProject
step
'I click link "Fork"'
do
expect
(
page
).
to
have_content
"Shop"
click_link
"Fork"
end
step
'I am a member of project "Shop"'
do
@project
=
create
(
:project
,
:repository
,
name:
"Shop"
)
@project
.
add_reporter
(
@user
)
end
step
'I should see the forked project page'
do
expect
(
page
).
to
have_content
"Forked from"
end
step
'I already have a project named "Shop" in my namespace'
do
@my_project
=
create
(
:project
,
:repository
,
name:
"Shop"
,
namespace:
current_user
.
namespace
)
end
step
'I should see a "Name has already been taken" warning'
do
expect
(
page
).
to
have_content
"Name has already been taken"
end
step
'I fork to my namespace'
do
page
.
within
'.fork-thumbnail-container'
do
click_link
current_user
.
name
end
end
step
'I should see "New merge request"'
do
expect
(
page
).
to
have_content
(
/new merge request/i
)
end
step
'I goto the Merge Requests page'
do
page
.
within
'.nav-sidebar'
do
first
(
:link
,
"Merge Requests"
).
click
end
end
step
'I click link "New merge request"'
do
page
.
within
'#content-body'
do
page
.
has_link?
(
'New Merge Request'
)
?
click_link
(
"New Merge Request"
)
:
click_link
(
'New merge request'
)
end
end
step
'I should see the new merge request page for my namespace'
do
current_path
.
should
have_content
(
/
#{
current_user
.
namespace
.
name
}
/i
)
end
step
'I visit the forks page of the "Shop" project'
do
@project
=
Project
.
where
(
name:
'Shop'
).
first
visit
project_forks_path
(
@project
)
end
step
'I should see my fork on the list'
do
page
.
within
(
'.js-projects-list-holder'
)
do
project
=
@user
.
fork_of
(
@project
.
reload
)
expect
(
page
).
to
have_content
(
"
#{
project
.
namespace
.
human_name
}
/
#{
project
.
name
}
"
)
end
end
step
'I make forked repo invalid'
do
project
=
@user
.
fork_of
(
@project
.
reload
)
project
.
path
=
'test-crappy-path'
project
.
save!
end
step
'There is an existent fork of the "Shop" project'
do
user
=
create
(
:user
,
name:
'Mike'
)
@project
.
add_reporter
(
user
)
@forked_project
=
Projects
::
ForkService
.
new
(
@project
,
user
).
execute
end
step
'I should not see the other fork listed'
do
expect
(
page
).
not_to
have_content
(
"
#{
@forked_project
.
namespace
.
human_name
}
/
#{
@forked_project
.
name
}
"
)
end
step
'I should see a private fork notice'
do
expect
(
page
).
to
have_content
(
"1 private fork"
)
end
end
spec/features/projects/fork_spec.rb
View file @
e4558010
...
@@ -25,6 +25,110 @@ describe 'Project fork' do
...
@@ -25,6 +25,110 @@ describe 'Project fork' do
expect
(
page
).
to
have_css
(
'a.disabled'
,
text:
'Fork'
)
expect
(
page
).
to
have_css
(
'a.disabled'
,
text:
'Fork'
)
end
end
it
'forks the project'
do
visit
project_path
(
project
)
click_link
'Fork'
page
.
within
'.fork-thumbnail-container'
do
click_link
user
.
name
end
expect
(
page
).
to
have_content
'Forked from'
visit
project_path
(
project
)
expect
(
page
).
to
have_content
(
/new merge request/i
)
page
.
within
'.nav-sidebar'
do
first
(
:link
,
'Merge Requests'
).
click
end
expect
(
page
).
to
have_content
(
/new merge request/i
)
page
.
within
'#content-body'
do
click_link
(
'New merge request'
)
end
expect
(
current_path
).
to
have_content
(
/
#{
user
.
namespace
.
name
}
/i
)
end
it
'shows the forked project on the list'
do
visit
project_path
(
project
)
click_link
'Fork'
page
.
within
'.fork-thumbnail-container'
do
click_link
user
.
name
end
visit
project_forks_path
(
project
)
forked_project
=
user
.
fork_of
(
project
.
reload
)
page
.
within
(
'.js-projects-list-holder'
)
do
expect
(
page
).
to
have_content
(
"
#{
forked_project
.
namespace
.
human_name
}
/
#{
forked_project
.
name
}
"
)
end
forked_project
.
update!
(
path:
'test-crappy-path'
)
visit
project_forks_path
(
project
)
page
.
within
(
'.js-projects-list-holder'
)
do
expect
(
page
).
to
have_content
(
"
#{
forked_project
.
namespace
.
human_name
}
/
#{
forked_project
.
name
}
"
)
end
end
context
'when the project is private'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:another_user
)
{
create
(
:user
,
name:
'Mike'
)
}
before
do
project
.
add_reporter
(
user
)
project
.
add_reporter
(
another_user
)
end
it
'renders private forks of the project'
do
visit
project_path
(
project
)
another_project_fork
=
Projects
::
ForkService
.
new
(
project
,
another_user
).
execute
click_link
'Fork'
page
.
within
'.fork-thumbnail-container'
do
click_link
user
.
name
end
visit
project_forks_path
(
project
)
page
.
within
(
'.js-projects-list-holder'
)
do
user_project_fork
=
user
.
fork_of
(
project
.
reload
)
expect
(
page
).
to
have_content
(
"
#{
user_project_fork
.
namespace
.
human_name
}
/
#{
user_project_fork
.
name
}
"
)
end
expect
(
page
).
not_to
have_content
(
"
#{
another_project_fork
.
namespace
.
human_name
}
/
#{
another_project_fork
.
name
}
"
)
expect
(
page
).
to
have_content
(
"1 private fork"
)
end
end
context
'when the user already forked the project'
do
before
do
create
(
:project
,
:repository
,
name:
project
.
name
,
namespace:
user
.
namespace
)
end
it
'renders error'
do
visit
project_path
(
project
)
click_link
'Fork'
page
.
within
'.fork-thumbnail-container'
do
click_link
user
.
name
end
expect
(
page
).
to
have_content
"Name has already been taken"
end
end
context
'master in group'
do
context
'master in group'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
)
}
...
...
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