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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
021fcebc
Commit
021fcebc
authored
Jan 20, 2018
by
Semyon Pupkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move user page spinach tests to RSpec
https://gitlab.com/gitlab-org/gitlab-ce/issues/23036
parent
8f5d1d13
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
107 additions
and
124 deletions
+107
-124
features/steps/user.rb
features/steps/user.rb
+0
-38
features/user.feature
features/user.feature
+0
-86
spec/features/user_page_spec.rb
spec/features/user_page_spec.rb
+107
-0
No files found.
features/steps/user.rb
deleted
100644 → 0
View file @
8f5d1d13
class
Spinach::Features::User
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedPaths
include
SharedUser
include
SharedProject
step
'I should see user "John Doe" page'
do
expect
(
title
).
to
match
(
/^\s*John Doe/
)
end
step
'"John Doe" has contributions'
do
user
=
User
.
find_by
(
name:
'John Doe'
)
project
=
contributed_project
# Issue contribution
issue_params
=
{
title:
'Bug in old browser'
}
Issues
::
CreateService
.
new
(
project
,
user
,
issue_params
).
execute
# Push code contribution
event
=
create
(
:push_event
,
project:
project
,
author:
user
)
create
(
:push_event_payload
,
event:
event
,
commit_count:
3
)
end
step
'I should see contributed projects'
do
page
.
within
'#contributed'
do
expect
(
page
).
to
have_content
(
@contributed_project
.
name
)
end
end
step
'I should see contributions calendar'
do
expect
(
page
).
to
have_css
(
'.js-contrib-calendar'
)
end
def
contributed_project
@contributed_project
||=
create
(
:project
,
:public
,
:empty_repo
)
end
end
features/user.feature
deleted
100644 → 0
View file @
8f5d1d13
Feature
:
User
Background
:
Given
User
"John Doe"
exists
And
"John Doe"
owns private project
"Enterprise"
# Signed out
@javascript
Scenario
:
I
visit user
"John Doe"
page while not signed in when he owns a public project
Given
"John Doe"
owns internal project
"Internal"
And
"John Doe"
owns public project
"Community"
When
I visit user
"John Doe"
page
And
I click on
"Personal projects"
tab
Then
I should see user
"John Doe"
page
And
I should not see project
"Enterprise"
And
I should not see project
"Internal"
And
I should see project
"Community"
# Signed in as someone else
@javascript
Scenario
:
I
visit user
"John Doe"
page while signed in as someone else when he owns a public project
Given
"John Doe"
owns public project
"Community"
And
"John Doe"
owns internal project
"Internal"
And
I sign in as a user
When
I visit user
"John Doe"
page
And
I click on
"Personal projects"
tab
Then
I should see user
"John Doe"
page
And
I should not see project
"Enterprise"
And
I should see project
"Internal"
And
I should see project
"Community"
@javascript
Scenario
:
I
visit user
"John Doe"
page while signed in as someone else when he is not authorized to a public project
Given
"John Doe"
owns internal project
"Internal"
And
I sign in as a user
When
I visit user
"John Doe"
page
And
I click on
"Personal projects"
tab
Then
I should see user
"John Doe"
page
And
I should not see project
"Enterprise"
And
I should see project
"Internal"
And
I should not see project
"Community"
@javascript
Scenario
:
I
visit user
"John Doe"
page while signed in as someone else when he is not authorized to a project I can see
Given
I sign in as a user
When
I visit user
"John Doe"
page
And
I click on
"Personal projects"
tab
Then
I should see user
"John Doe"
page
And
I should not see project
"Enterprise"
And
I should not see project
"Internal"
And
I should not see project
"Community"
# Signed in as the user himself
@javascript
Scenario
:
I
visit user
"John Doe"
page while signed in as
"John Doe"
when he has a public project
Given
"John Doe"
owns internal project
"Internal"
And
"John Doe"
owns public project
"Community"
And
I sign in as
"John Doe"
When
I visit user
"John Doe"
page
And
I click on
"Personal projects"
tab
Then
I should see user
"John Doe"
page
And
I should see project
"Enterprise"
And
I should see project
"Internal"
And
I should see project
"Community"
@javascript
Scenario
:
I
visit user
"John Doe"
page while signed in as
"John Doe"
when he has no public project
Given
I sign in as
"John Doe"
When
I visit user
"John Doe"
page
And
I click on
"Personal projects"
tab
Then
I should see user
"John Doe"
page
And
I should see project
"Enterprise"
And
I should not see project
"Internal"
And
I should not see project
"Community"
@javascript
Scenario
:
"John Doe" contribution profile
Given
I sign in as a user
And
"John Doe"
has contributions
When
I visit user
"John Doe"
page
And
I click on
"Contributed projects"
tab
Then
I should see user
"John Doe"
page
And
I should see contributed projects
And
I should see contributions calendar
spec/features/user_page_spec.rb
0 → 100644
View file @
021fcebc
require
'spec_helper'
describe
'User page'
,
:js
do
let!
(
:user
)
{
create
:user
}
let!
(
:private_project
)
do
create
:project
,
:private
,
name:
'private'
,
namespace:
user
.
namespace
do
|
project
|
project
.
add_master
(
user
)
end
end
let!
(
:internal_project
)
do
create
:project
,
:internal
,
name:
'internal'
,
namespace:
user
.
namespace
do
|
project
|
project
.
add_master
(
user
)
end
end
let!
(
:public_project
)
do
create
:project
,
:public
,
name:
'public'
,
namespace:
user
.
namespace
do
|
project
|
project
.
add_master
(
user
)
end
end
def
click_nav_link
(
name
)
page
.
within
'.nav-links'
do
click_link
name
end
end
context
'when not signed in'
do
it
'renders user public project'
do
visit
user_path
(
user
)
click_nav_link
(
'Personal projects'
)
expect
(
page
).
to
have_css
(
'.tab-content #projects.active'
)
expect
(
title
).
to
start_with
(
user
.
name
)
expect
(
page
).
to
have_content
(
public_project
.
name
)
expect
(
page
).
not_to
have_content
(
private_project
.
name
)
expect
(
page
).
not_to
have_content
(
internal_project
.
name
)
end
end
context
'when signed in as another user'
do
let
(
:another_user
)
{
create
:user
}
before
do
sign_in
(
another_user
)
end
it
'renders user public and internal projects'
do
visit
user_path
(
user
)
click_nav_link
(
'Personal projects'
)
expect
(
title
).
to
start_with
(
user
.
name
)
expect
(
page
).
not_to
have_content
(
private_project
.
name
)
expect
(
page
).
to
have_content
(
public_project
.
name
)
expect
(
page
).
to
have_content
(
internal_project
.
name
)
end
end
context
'when signed in as user'
do
before
do
sign_in
(
user
)
end
describe
'personal projects'
do
it
'renders all user projects'
do
visit
user_path
(
user
)
click_nav_link
(
'Personal projects'
)
expect
(
title
).
to
start_with
(
user
.
name
)
expect
(
page
).
to
have_content
(
private_project
.
name
)
expect
(
page
).
to
have_content
(
public_project
.
name
)
expect
(
page
).
to
have_content
(
internal_project
.
name
)
end
end
describe
'contributed projects'
do
context
'when user has contributions'
do
let
(
:contributed_project
)
do
create
:project
,
:public
,
:empty_repo
end
before
do
Issues
::
CreateService
.
new
(
contributed_project
,
user
,
{
title:
'Bug in old browser'
}).
execute
event
=
create
(
:push_event
,
project:
contributed_project
,
author:
user
)
create
(
:push_event_payload
,
event:
event
,
commit_count:
3
)
end
it
'renders contributed project'
do
visit
user_path
(
user
)
expect
(
title
).
to
start_with
(
user
.
name
)
expect
(
page
).
to
have_css
(
'.js-contrib-calendar'
)
click_nav_link
(
'Contributed projects'
)
page
.
within
'#contributed'
do
expect
(
page
).
to
have_content
(
contributed_project
.
name
)
end
end
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