Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
335736f6
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,体验更适合开发者的 AI 搜索 >>
提交
335736f6
编写于
3月 10, 2018
作者:
S
Semyon Pupkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replace project redirects spinach tests with RSpec analog
https://gitlab.com/gitlab-org/gitlab-ce/issues/23036
上级
afd2d381
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
74 addition
and
105 deletion
+74
-105
features/project/redirects.feature
features/project/redirects.feature
+0
-38
features/steps/project/redirects.rb
features/steps/project/redirects.rb
+0
-67
spec/features/projects/redirects_spec.rb
spec/features/projects/redirects_spec.rb
+74
-0
未找到文件。
features/project/redirects.feature
已删除
100644 → 0
浏览文件 @
afd2d381
Feature
:
Project Redirects
Background
:
Given
public project
"Community"
And
private project
"Enterprise"
Scenario
:
I
visit public project page
When
I visit project
"Community"
page
Then
I should see project
"Community"
home page
Scenario
:
I
visit private project page
When
I visit project
"Enterprise"
page
Then
I should be redirected to sign in page
Scenario
:
I
visit a non-existent project page
When
I visit project
"CommunityDoesNotExist"
page
Then
I should be redirected to sign in page
Scenario
:
I
visit a non-existent project page as user
Given
I sign in as a user
When
I visit project
"CommunityDoesNotExist"
page
Then
page status code should be 404
Scenario
:
I
visit unauthorized project page as user
Given
I sign in as a user
When
I visit project
"Enterprise"
page
Then
page status code should be 404
Scenario
:
I
visit a public project without signing in
When
I visit project
"Community"
page
And
I should see project
"Community"
home page
And
I click on
"Sign In"
And
Authenticate
Then
I should be redirected to
"Community"
page
Scenario
:
I
visit private project page without signing in
When
I visit project
"Enterprise"
page
And
I get redirected to signin page where I sign in
Then
I should be redirected to
"Enterprise"
page
features/steps/project/redirects.rb
已删除
100644 → 0
浏览文件 @
afd2d381
class
Spinach::Features::ProjectRedirects
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedPaths
include
SharedProject
step
'public project "Community"'
do
create
(
:project
,
:public
,
name:
'Community'
)
end
step
'private project "Enterprise"'
do
create
(
:project
,
:private
,
name:
'Enterprise'
)
end
step
'I visit project "Community" page'
do
project
=
Project
.
find_by
(
name:
'Community'
)
visit
project_path
(
project
)
end
step
'I should see project "Community" home page'
do
Gitlab
.
config
.
gitlab
.
should_receive
(
:host
).
and_return
(
"www.example.com"
)
page
.
within
'.breadcrumbs .breadcrumb-item-text'
do
expect
(
page
).
to
have_content
'Community'
end
end
step
'I visit project "Enterprise" page'
do
project
=
Project
.
find_by
(
name:
'Enterprise'
)
visit
project_path
(
project
)
end
step
'I visit project "CommunityDoesNotExist" page'
do
project
=
Project
.
find_by
(
name:
'Community'
)
visit
project_path
(
project
)
+
'DoesNotExist'
end
step
'I click on "Sign In"'
do
first
(
:link
,
"Sign in"
).
click
end
step
'Authenticate'
do
admin
=
create
(
:admin
)
fill_in
"user_login"
,
with:
admin
.
email
fill_in
"user_password"
,
with:
admin
.
password
click_button
"Sign in"
Thread
.
current
[
:current_user
]
=
admin
end
step
'I should be redirected to "Community" page'
do
project
=
Project
.
find_by
(
name:
'Community'
)
expect
(
current_path
).
to
eq
"/
#{
project
.
full_path
}
"
expect
(
status_code
).
to
eq
200
end
step
'I get redirected to signin page where I sign in'
do
admin
=
create
(
:admin
)
fill_in
"user_login"
,
with:
admin
.
email
fill_in
"user_password"
,
with:
admin
.
password
click_button
"Sign in"
Thread
.
current
[
:current_user
]
=
admin
end
step
'I should be redirected to "Enterprise" page'
do
project
=
Project
.
find_by
(
name:
'Enterprise'
)
expect
(
current_path
).
to
eq
"/
#{
project
.
full_path
}
"
expect
(
status_code
).
to
eq
200
end
end
spec/features/projects/redirects_spec.rb
0 → 100644
浏览文件 @
335736f6
require
'spec_helper'
describe
'Project redirects'
do
let
(
:user
)
{
create
:user
}
let
(
:public_project
)
{
create
:project
,
:public
}
let
(
:private_project
)
{
create
:project
,
:private
}
before
do
allow
(
Gitlab
.
config
.
gitlab
).
to
receive
(
:host
).
and_return
(
'www.example.com'
)
end
it
'shows public project page'
do
visit
project_path
(
public_project
)
page
.
within
'.breadcrumbs .breadcrumb-item-text'
do
expect
(
page
).
to
have_content
(
public_project
.
name
)
end
end
it
'redirects to sign in page when project is private'
do
visit
project_path
(
private_project
)
expect
(
current_path
).
to
eq
(
new_user_session_path
)
end
it
'redirects to sign in page when project does not exist'
do
visit
project_path
(
build
(
:project
,
:public
))
expect
(
current_path
).
to
eq
(
new_user_session_path
)
end
it
'redirects to public project page after signing in'
do
visit
project_path
(
public_project
)
first
(
:link
,
'Sign in'
).
click
fill_in
'user_login'
,
with:
user
.
email
fill_in
'user_password'
,
with:
user
.
password
click_button
'Sign in'
expect
(
status_code
).
to
eq
(
200
)
expect
(
current_path
).
to
eq
(
"/
#{
public_project
.
full_path
}
"
)
end
it
'redirects to private project page after sign in'
do
visit
project_path
(
private_project
)
owner
=
private_project
.
owner
fill_in
'user_login'
,
with:
owner
.
email
fill_in
'user_password'
,
with:
owner
.
password
click_button
'Sign in'
expect
(
status_code
).
to
eq
(
200
)
expect
(
current_path
).
to
eq
(
"/
#{
private_project
.
full_path
}
"
)
end
context
'when signed in'
do
before
do
sign_in
(
user
)
end
it
'returns 404 status when project does not exist'
do
visit
project_path
(
build
(
:project
,
:public
))
expect
(
status_code
).
to
eq
(
404
)
end
it
'returns 404 when project is private'
do
visit
project_path
(
private_project
)
expect
(
status_code
).
to
eq
(
404
)
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录