Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
ef2ed380
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ef2ed380
编写于
10月 02, 2016
作者:
R
Robert Speicher
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Convert "SSH Keys" Spinach features to RSpec
上级
71345998
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
43 addition
and
70 deletion
+43
-70
features/profile/ssh_keys.feature
features/profile/ssh_keys.feature
+0
-20
features/steps/profile/ssh_keys.rb
features/steps/profile/ssh_keys.rb
+0
-46
spec/features/profiles/keys_spec.rb
spec/features/profiles/keys_spec.rb
+43
-4
未找到文件。
features/profile/ssh_keys.feature
已删除
100644 → 0
浏览文件 @
71345998
@profile
Feature
:
Profile SSH Keys
Background
:
Given
I sign in as a user
And
I have ssh key
"ssh-rsa Work"
And
I visit profile keys page
Scenario
:
I
should see ssh keys
Then
I should see my ssh keys
Scenario
:
Add new ssh key
Given
I should see new ssh key form
And
I submit new ssh key
"Laptop"
Then
I should see new ssh key
"Laptop"
Scenario
:
Remove ssh key
Given
I click link
"Work"
And
I click link
"Remove"
Then
I visit profile keys page
And
I should not see
"Work"
ssh key
features/steps/profile/ssh_keys.rb
已删除
100644 → 0
浏览文件 @
71345998
class
Spinach::Features::ProfileSshKeys
<
Spinach
::
FeatureSteps
include
SharedAuthentication
step
'I should see my ssh keys'
do
@user
.
keys
.
each
do
|
key
|
expect
(
page
).
to
have_content
(
key
.
title
)
end
end
step
'I should see new ssh key form'
do
expect
(
page
).
to
have_content
(
"Add an SSH key"
)
end
step
'I submit new ssh key "Laptop"'
do
fill_in
"key_title"
,
with:
"Laptop"
fill_in
"key_key"
,
with:
"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@laptop"
click_button
"Add key"
end
step
'I should see new ssh key "Laptop"'
do
key
=
Key
.
find_by
(
title:
"Laptop"
)
expect
(
page
).
to
have_content
(
key
.
title
)
expect
(
page
).
to
have_content
(
key
.
key
)
expect
(
current_path
).
to
eq
profile_key_path
(
key
)
end
step
'I click link "Work"'
do
click_link
"Work"
end
step
'I click link "Remove"'
do
click_link
"Remove"
end
step
'I visit profile keys page'
do
visit
profile_keys_path
end
step
'I should not see "Work" ssh key'
do
expect
(
page
).
not_to
have_content
"Work"
end
step
'I have ssh key "ssh-rsa Work"'
do
create
(
:key
,
user:
@user
,
title:
"ssh-rsa Work"
,
key:
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+L3TbFegm3k8QjejSwemk4HhlRh+DuN679Pc5ckqE/MPhVtE/+kZQDYCTB284GiT2aIoGzmZ8ee9TkaoejAsBwlA+Wz2Q3vhz65X6sMgalRwpdJx8kSEUYV8ZPV3MZvPo8KdNg993o4jL6G36GDW4BPIyO6FPZhfsawdf6liVD0Xo5kibIK7B9VoE178cdLQtLpS2YolRwf5yy6XR6hbbBGQR+6xrGOdP16eGZDb1CE2bMvvJijjloFqPscGktWOqW+nfh5txwFfBzlfARDTBsS8WZtg3Yoj1kn33kPsWRlgHfNutFRAIynDuDdQzQq8tTtVwm+Yi75RfcPHW8y3P Work"
)
end
end
spec/features/profiles/keys_spec.rb
浏览文件 @
ef2ed380
require
'rails_helper'
describ
e
'Profile > SSH Keys'
,
feature:
true
do
featur
e
'Profile > SSH Keys'
,
feature:
true
do
let
(
:user
)
{
create
(
:user
)
}
before
do
login_as
(
user
)
visit
profile_keys_path
end
describe
'User adds an SSH key'
do
it
'auto-populates the title'
,
js:
true
do
describe
'User adds a key'
do
before
do
visit
profile_keys_path
end
scenario
'auto-populates the title'
,
js:
true
do
fill_in
(
'Key'
,
with:
attributes_for
(
:key
).
fetch
(
:key
))
expect
(
find_field
(
'Title'
).
value
).
to
eq
'dummy@gitlab.com'
end
scenario
'saves the new key'
do
attrs
=
attributes_for
(
:key
)
fill_in
(
'Key'
,
with:
attrs
[
:key
])
fill_in
(
'Title'
,
with:
attrs
[
:title
])
click_button
(
'Add key'
)
expect
(
page
).
to
have_content
(
"Title:
#{
attrs
[
:title
]
}
"
)
expect
(
page
).
to
have_content
(
attrs
[
:key
])
end
end
scenario
'User sees their keys'
do
key
=
create
(
:key
,
user:
user
)
visit
profile_keys_path
expect
(
page
).
to
have_content
(
key
.
title
)
end
scenario
'User removes a key via the key index'
do
create
(
:key
,
user:
user
)
visit
profile_keys_path
click_link
(
'Remove'
)
expect
(
page
).
to
have_content
(
'Your SSH keys (0)'
)
end
scenario
'User removes a key via its details page'
do
key
=
create
(
:key
,
user:
user
)
visit
profile_key_path
(
key
)
click_link
(
'Remove'
)
expect
(
page
).
to
have_content
(
'Your SSH keys (0)'
)
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录