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
Boxiang Sun
gitlab-ce
Commits
3b21da84
Commit
3b21da84
authored
May 09, 2018
by
blackst0ne
Committed by
Robert Speicher
May 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace the `project/deploy_keys.feature` spinach test with an rspec analog
parent
1a9f90f8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
130 additions
and
144 deletions
+130
-144
changelogs/unreleased/blackst0ne-replace-spinach-project-deploy-keys-feature.yml
...lackst0ne-replace-spinach-project-deploy-keys-feature.yml
+5
-0
features/project/deploy_keys.feature
features/project/deploy_keys.feature
+0
-46
features/steps/project/deploy_keys.rb
features/steps/project/deploy_keys.rb
+0
-94
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+0
-4
spec/features/projects/settings/user_interacts_with_deploy_keys_spec.rb
...projects/settings/user_interacts_with_deploy_keys_spec.rb
+125
-0
No files found.
changelogs/unreleased/blackst0ne-replace-spinach-project-deploy-keys-feature.yml
0 → 100644
View file @
3b21da84
---
title
:
'
Replace
the
`project/deploy_keys.feature`
spinach
test
with
an
rspec
analog'
merge_request
:
18796
author
:
'
@blackst0ne'
type
:
other
features/project/deploy_keys.feature
deleted
100644 → 0
View file @
1a9f90f8
Feature
:
Project Deploy Keys
Background
:
Given
I sign in as a user
And
I own project
"Shop"
@javascript
Scenario
:
I
should see deploy keys list
Given
project has deploy key
When
I visit project deploy keys page
Then
I should see project deploy key
@javascript
Scenario
:
I
should see project deploy keys
Given
other projects have deploy keys
When
I visit project deploy keys page
Then
I should see other project deploy key
And
I should only see the same deploy key once
@javascript
Scenario
:
I
should see public deploy keys
Given
public deploy key exists
When
I visit project deploy keys page
Then
I should see public deploy key
@javascript
Scenario
:
I
add new deploy key
Given
I visit project deploy keys page
And
I submit new deploy key
Then
I should be on deploy keys page
And
I should see newly created deploy key
@javascript
Scenario
:
I
attach other project deploy key to project
Given
other projects have deploy keys
And
I visit project deploy keys page
When
I click attach deploy key
Then
I should be on deploy keys page
And
I should see newly created deploy key
@javascript
Scenario
:
I
attach public deploy key to project
Given
public deploy key exists
And
I visit project deploy keys page
When
I click attach deploy key
Then
I should be on deploy keys page
And
I should see newly created deploy key
features/steps/project/deploy_keys.rb
deleted
100644 → 0
View file @
1a9f90f8
class
Spinach::Features::ProjectDeployKeys
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedProject
include
SharedPaths
step
'project has deploy key'
do
create
(
:deploy_keys_project
,
project:
@project
)
end
step
'I should see project deploy key'
do
page
.
within
(
find
(
'.deploy-keys'
))
do
find
(
'.js-deployKeys-tab-enabled_keys'
).
click
()
expect
(
page
).
to
have_content
deploy_key
.
title
end
end
step
'I should see other project deploy key'
do
page
.
within
(
find
(
'.deploy-keys'
))
do
find
(
'.js-deployKeys-tab-available_project_keys'
).
click
()
expect
(
page
).
to
have_content
other_deploy_key
.
title
end
end
step
'I should see public deploy key'
do
page
.
within
(
find
(
'.deploy-keys'
))
do
find
(
'.js-deployKeys-tab-public_keys'
).
click
()
expect
(
page
).
to
have_content
public_deploy_key
.
title
end
end
step
'I click \'New Deploy Key\''
do
click_link
'New deploy key'
end
step
'I submit new deploy key'
do
fill_in
"deploy_key_title"
,
with:
"laptop"
fill_in
"deploy_key_key"
,
with:
"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@laptop"
click_button
"Add key"
end
step
'I should be on deploy keys page'
do
expect
(
current_path
).
to
eq
project_settings_repository_path
(
@project
)
end
step
'I should see newly created deploy key'
do
@project
.
reload
page
.
within
(
find
(
'.deploy-keys'
))
do
find
(
'.js-deployKeys-tab-enabled_keys'
).
click
()
expect
(
page
).
to
have_content
(
deploy_key
.
title
)
end
end
step
'other projects have deploy keys'
do
@second_project
=
create
(
:project
,
namespace:
create
(
:group
))
@second_project
.
add_master
(
current_user
)
create
(
:deploy_keys_project
,
project:
@second_project
)
@third_project
=
create
(
:project
,
namespace:
create
(
:group
))
@third_project
.
add_master
(
current_user
)
create
(
:deploy_keys_project
,
project:
@third_project
,
deploy_key:
@second_project
.
deploy_keys
.
first
)
end
step
'I should only see the same deploy key once'
do
page
.
within
(
find
(
'.deploy-keys'
))
do
expect
(
find
(
'.js-deployKeys-tab-available_project_keys .badge'
)).
to
have_content
(
'1'
)
end
end
step
'public deploy key exists'
do
create
(
:deploy_key
,
public:
true
)
end
step
'I click attach deploy key'
do
page
.
within
(
find
(
'.deploy-keys'
))
do
find
(
'.badge'
,
text:
'1'
).
click
()
click_button
'Enable'
expect
(
page
).
not_to
have_selector
(
'.fa-spinner'
)
end
end
protected
def
deploy_key
@project
.
deploy_keys
.
last
end
def
other_deploy_key
@second_project
.
deploy_keys
.
last
end
def
public_deploy_key
DeployKey
.
are_public
.
last
end
end
features/steps/shared/paths.rb
View file @
3b21da84
...
...
@@ -240,10 +240,6 @@ module SharedPaths
visit
project_settings_integrations_path
(
@project
)
end
step
'I visit project deploy keys page'
do
visit
project_deploy_keys_path
(
@project
)
end
step
'I visit project find file page'
do
visit
project_find_file_path
(
@project
,
root_ref
)
end
...
...
spec/features/projects/settings/user_interacts_with_deploy_keys_spec.rb
0 → 100644
View file @
3b21da84
require
"spec_helper"
describe
"User interacts with deploy keys"
,
:js
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
project
.
owner
}
before
do
sign_in
(
user
)
end
shared_examples
"attaches a key"
do
it
"attaches key"
do
visit
(
project_deploy_keys_path
(
project
))
page
.
within
(
".deploy-keys"
)
do
find
(
".badge"
,
text:
"1"
).
click
click_button
(
"Enable"
)
expect
(
page
).
not_to
have_selector
(
".fa-spinner"
)
expect
(
current_path
).
to
eq
(
project_settings_repository_path
(
project
))
find
(
".js-deployKeys-tab-enabled_keys"
).
click
expect
(
page
).
to
have_content
(
deploy_key
.
title
)
end
end
end
context
"viewing deploy keys"
do
let
(
:deploy_key
)
{
create
(
:deploy_key
)
}
context
"when project has keys"
do
before
do
create
(
:deploy_keys_project
,
project:
project
,
deploy_key:
deploy_key
)
end
it
"shows deploy keys"
do
visit
(
project_deploy_keys_path
(
project
))
page
.
within
(
".deploy-keys"
)
do
expect
(
page
).
to
have_content
(
deploy_key
.
title
)
end
end
end
context
"when another project has keys"
do
let
(
:another_project
)
{
create
(
:project
)
}
before
do
create
(
:deploy_keys_project
,
project:
another_project
,
deploy_key:
deploy_key
)
another_project
.
add_master
(
user
)
end
it
"shows deploy keys"
do
visit
(
project_deploy_keys_path
(
project
))
page
.
within
(
".deploy-keys"
)
do
find
(
'.js-deployKeys-tab-available_project_keys'
).
click
expect
(
page
).
to
have_content
(
deploy_key
.
title
)
expect
(
find
(
".js-deployKeys-tab-available_project_keys .badge"
)).
to
have_content
(
"1"
)
end
end
end
context
"when there are public deploy keys"
do
let!
(
:deploy_key
)
{
create
(
:deploy_key
,
public:
true
)
}
it
"shows public deploy keys"
do
visit
(
project_deploy_keys_path
(
project
))
page
.
within
(
".deploy-keys"
)
do
find
(
".js-deployKeys-tab-public_keys"
).
click
expect
(
page
).
to
have_content
(
deploy_key
.
title
)
end
end
end
end
context
"adding deploy keys"
do
before
do
visit
(
project_deploy_keys_path
(
project
))
end
it
"adds new key"
do
DEPLOY_KEY_TITLE
=
attributes_for
(
:key
)[
:title
]
DEPLOY_KEY_BODY
=
attributes_for
(
:key
)[
:key
]
fill_in
(
"deploy_key_title"
,
with:
DEPLOY_KEY_TITLE
)
fill_in
(
"deploy_key_key"
,
with:
DEPLOY_KEY_BODY
)
click_button
(
"Add key"
)
expect
(
current_path
).
to
eq
(
project_settings_repository_path
(
project
))
page
.
within
(
".deploy-keys"
)
do
expect
(
page
).
to
have_content
(
DEPLOY_KEY_TITLE
)
end
end
end
context
"attaching existing keys"
do
context
"from another project"
do
let
(
:another_project
)
{
create
(
:project
)
}
let
(
:deploy_key
)
{
create
(
:deploy_key
)
}
before
do
create
(
:deploy_keys_project
,
project:
another_project
,
deploy_key:
deploy_key
)
another_project
.
add_master
(
user
)
end
it_behaves_like
"attaches a key"
end
context
"when keys are public"
do
let!
(
:deploy_key
)
{
create
(
:deploy_key
,
public:
true
)
}
it_behaves_like
"attaches a key"
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