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
ad398310
Commit
ad398310
authored
Dec 19, 2016
by
Semyon Pupkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move admin projects spinach tests to rspec
https://gitlab.com/gitlab-org/gitlab-ce/issues/23036
parent
a50cd9eb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
91 additions
and
159 deletions
+91
-159
features/admin/projects.feature
features/admin/projects.feature
+0
-47
features/steps/admin/projects.rb
features/steps/admin/projects.rb
+0
-104
spec/features/admin/admin_projects_spec.rb
spec/features/admin/admin_projects_spec.rb
+91
-8
No files found.
features/admin/projects.feature
deleted
100644 → 0
View file @
a50cd9eb
@admin
Feature
:
Admin Projects
Background
:
Given
I sign in as an admin
And
there are projects in system
Scenario
:
I
should see non-archived projects in the list
Given
archived project
"Archive"
When
I visit admin projects page
Then
I should see all non-archived projects
And
I should not see project
"Archive"
@javascript
Scenario
:
I
should see all projects in the list
Given
archived project
"Archive"
When
I visit admin projects page
And
I select
"Show archived projects"
Then
I should see all projects
And
I should see
"archived"
label
Scenario
:
Projects show
When
I visit admin projects page
And
I click on first project
Then
I should see project details
@javascript
Scenario
:
Transfer project
Given
group 'Web'
And
I visit admin project page
When
I transfer project to group 'Web'
Then
I should see project transfered
@javascript
Scenario
:
Signed in admin should be able to add himself to a project
Given
"John Doe"
owns private project
"Enterprise"
When
I visit project
"Enterprise"
members page
When
I select current user as
"Developer"
Then
I should see current user as
"Developer"
@javascript
Scenario
:
Signed in admin should be able to remove himself from a project
Given
"John Doe"
owns private project
"Enterprise"
And
current user is developer of project
"Enterprise"
When
I visit project
"Enterprise"
members page
Then
I should see current user as
"Developer"
When
I click on the
"Remove User From Project"
button for current user
Then
I should not see current user as
"Developer"
features/steps/admin/projects.rb
deleted
100644 → 0
View file @
a50cd9eb
class
Spinach::Features::AdminProjects
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedPaths
include
SharedAdmin
include
SharedProject
include
SharedUser
include
Select2Helper
step
'I should see all non-archived projects'
do
Project
.
non_archived
.
each
do
|
p
|
expect
(
page
).
to
have_content
p
.
name_with_namespace
end
end
step
'I should see all projects'
do
Project
.
all
.
each
do
|
p
|
expect
(
page
).
to
have_content
p
.
name_with_namespace
end
end
step
'I select "Show archived projects"'
do
find
(
:css
,
'#sort-projects-dropdown'
).
click
click_link
'Show archived projects'
end
step
'I should see "archived" label'
do
expect
(
page
).
to
have_xpath
(
"//span[@class='label label-warning']"
,
text:
'archived'
)
end
step
'I click on first project'
do
click_link
Project
.
first
.
name_with_namespace
end
step
'I should see project details'
do
project
=
Project
.
first
expect
(
current_path
).
to
eq
admin_namespace_project_path
(
project
.
namespace
,
project
)
expect
(
page
).
to
have_content
(
project
.
name_with_namespace
)
expect
(
page
).
to
have_content
(
project
.
creator
.
name
)
end
step
'I visit admin project page'
do
visit
admin_namespace_project_path
(
project
.
namespace
,
project
)
end
step
'I transfer project to group \'Web\''
do
allow_any_instance_of
(
Projects
::
TransferService
).
to
receive
(
:move_uploads_to_new_namespace
).
and_return
(
true
)
click_button
'Search for Namespace'
click_link
'group: web'
click_button
'Transfer'
end
step
'group \'Web\''
do
create
(
:group
,
name:
'Web'
)
end
step
'I should see project transfered'
do
expect
(
page
).
to
have_content
'Web / '
+
project
.
name
expect
(
page
).
to
have_content
'Namespace: Web'
end
step
'I visit project "Enterprise" members page'
do
project
=
Project
.
find_by!
(
name:
"Enterprise"
)
visit
namespace_project_project_members_path
(
project
.
namespace
,
project
)
end
step
'I select current user as "Developer"'
do
page
.
within
".users-project-form"
do
select2
(
current_user
.
id
,
from:
"#user_ids"
,
multiple:
true
)
select
"Developer"
,
from:
"access_level"
end
click_button
"Add to project"
end
step
'I should see current user as "Developer"'
do
page
.
within
'.content-list'
do
expect
(
page
).
to
have_content
(
current_user
.
name
)
expect
(
page
).
to
have_content
(
'Developer'
)
end
end
step
'current user is developer of project "Enterprise"'
do
project
=
Project
.
find_by!
(
name:
"Enterprise"
)
project
.
team
<<
[
current_user
,
:developer
]
end
step
'I click on the "Remove User From Project" button for current user'
do
find
(
:css
,
'li'
,
text:
current_user
.
name
).
find
(
:css
,
'a.btn-remove'
).
click
# poltergeist always confirms popups.
end
step
'I should not see current_user as "Developer"'
do
expect
(
page
).
not_to
have_selector
(
:css
,
'.content-list'
)
end
def
project
@project
||=
Project
.
first
end
def
group
Group
.
find_by
(
name:
'Web'
)
end
end
spec/features/admin/admin_projects_spec.rb
View file @
ad398310
require
'spec_helper'
require
'spec_helper'
describe
"Admin::Projects"
,
feature:
true
do
describe
"Admin::Projects"
,
feature:
true
do
before
do
include
Select2Helper
@project
=
create
(
:project
)
let
(
:user
)
{
create
:user
}
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:current_user
)
do
login_as
:admin
login_as
:admin
end
end
describe
"GET /admin/projects"
do
describe
"GET /admin/projects"
do
let!
(
:archived_project
)
{
create
:project
,
:public
,
archived:
true
}
before
do
before
do
visit
admin_projects_path
visit
admin_projects_path
end
end
...
@@ -15,20 +20,98 @@ describe "Admin::Projects", feature: true do
...
@@ -15,20 +20,98 @@ describe "Admin::Projects", feature: true do
expect
(
current_path
).
to
eq
(
admin_projects_path
)
expect
(
current_path
).
to
eq
(
admin_projects_path
)
end
end
it
"has projects list"
do
it
'renders projects list without archived project'
do
expect
(
page
).
to
have_content
(
@project
.
name
)
expect
(
page
).
to
have_content
(
project
.
name
)
expect
(
page
).
not_to
have_content
(
archived_project
.
name
)
end
it
'renders all projects'
,
js:
true
do
find
(
:css
,
'#sort-projects-dropdown'
).
click
click_link
'Show archived projects'
expect
(
page
).
to
have_content
(
project
.
name
)
expect
(
page
).
to
have_content
(
archived_project
.
name
)
expect
(
page
).
to
have_xpath
(
"//span[@class='label label-warning']"
,
text:
'archived'
)
end
end
end
end
describe
"GET /admin/projects/:id"
do
describe
"GET /admin/projects/:
namespace_id/:
id"
do
before
do
before
do
visit
admin_projects_path
visit
admin_projects_path
click_link
"
#{
@project
.
name
}
"
click_link
"
#{
project
.
name
}
"
end
it
do
expect
(
current_path
).
to
eq
admin_namespace_project_path
(
project
.
namespace
,
project
)
end
end
it
"has project info"
do
it
"has project info"
do
expect
(
page
).
to
have_content
(
@project
.
path
)
expect
(
page
).
to
have_content
(
project
.
path
)
expect
(
page
).
to
have_content
(
@project
.
name
)
expect
(
page
).
to
have_content
(
project
.
name
)
expect
(
page
).
to
have_content
(
project
.
name_with_namespace
)
expect
(
page
).
to
have_content
(
project
.
creator
.
name
)
end
end
describe
'transfer project'
do
before
do
create
(
:group
,
name:
'Web'
)
allow_any_instance_of
(
Projects
::
TransferService
).
to
receive
(
:move_uploads_to_new_namespace
).
and_return
(
true
)
end
it
'transfers project to group web'
,
js:
true
do
visit
admin_namespace_project_path
(
project
.
namespace
,
project
)
click_button
'Search for Namespace'
click_link
'group: web'
click_button
'Transfer'
expect
(
page
).
to
have_content
(
"Web /
#{
project
.
name
}
"
)
expect
(
page
).
to
have_content
(
'Namespace: Web'
)
end
end
describe
'add admin himself to a project'
do
before
do
project
.
team
<<
[
user
,
:master
]
end
it
'adds admin a to a project as developer'
,
js:
true
do
visit
namespace_project_project_members_path
(
project
.
namespace
,
project
)
page
.
within
'.users-project-form'
do
select2
(
current_user
.
id
,
from:
'#user_ids'
,
multiple:
true
)
select
'Developer'
,
from:
'access_level'
end
click_button
'Add to project'
page
.
within
'.content-list'
do
expect
(
page
).
to
have_content
(
current_user
.
name
)
expect
(
page
).
to
have_content
(
'Developer'
)
end
end
end
describe
'admin remove himself from a project'
do
before
do
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
current_user
,
:developer
]
end
it
'removes admin from the project'
do
visit
namespace_project_project_members_path
(
project
.
namespace
,
project
)
page
.
within
'.content-list'
do
expect
(
page
).
to
have_content
(
current_user
.
name
)
expect
(
page
).
to
have_content
(
'Developer'
)
end
find
(
:css
,
'li'
,
text:
current_user
.
name
).
find
(
:css
,
'a.btn-remove'
).
click
expect
(
page
).
not_to
have_selector
(
:css
,
'.content-list'
)
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