Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
3a0d9314
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,发现更多精彩内容 >>
提交
3a0d9314
编写于
1月 26, 2017
作者:
R
Rémy Coutable
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'rs-empty_project-helpers' into 'master'
Use `:empty_project` where possible in helper specs See merge request !8796
上级
0d3380ab
2fe13fbc
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
41 addition
and
40 deletion
+41
-40
spec/helpers/application_helper_spec.rb
spec/helpers/application_helper_spec.rb
+2
-2
spec/helpers/blob_helper_spec.rb
spec/helpers/blob_helper_spec.rb
+1
-1
spec/helpers/gitlab_markdown_helper_spec.rb
spec/helpers/gitlab_markdown_helper_spec.rb
+10
-9
spec/helpers/graph_helper_spec.rb
spec/helpers/graph_helper_spec.rb
+1
-1
spec/helpers/issues_helper_spec.rb
spec/helpers/issues_helper_spec.rb
+1
-1
spec/helpers/members_helper_spec.rb
spec/helpers/members_helper_spec.rb
+1
-1
spec/helpers/merge_requests_helper_spec.rb
spec/helpers/merge_requests_helper_spec.rb
+5
-5
spec/helpers/milestones_helper_spec.rb
spec/helpers/milestones_helper_spec.rb
+6
-8
spec/helpers/preferences_helper_spec.rb
spec/helpers/preferences_helper_spec.rb
+1
-1
spec/helpers/projects_helper_spec.rb
spec/helpers/projects_helper_spec.rb
+2
-2
spec/helpers/search_helper_spec.rb
spec/helpers/search_helper_spec.rb
+4
-2
spec/helpers/submodule_helper_spec.rb
spec/helpers/submodule_helper_spec.rb
+2
-2
spec/helpers/tree_helper_spec.rb
spec/helpers/tree_helper_spec.rb
+1
-1
spec/helpers/visibility_level_helper_spec.rb
spec/helpers/visibility_level_helper_spec.rb
+4
-4
未找到文件。
spec/helpers/application_helper_spec.rb
浏览文件 @
3a0d9314
...
@@ -55,7 +55,7 @@ describe ApplicationHelper do
...
@@ -55,7 +55,7 @@ describe ApplicationHelper do
describe
'project_icon'
do
describe
'project_icon'
do
it
'returns an url for the avatar'
do
it
'returns an url for the avatar'
do
project
=
create
(
:project
,
avatar:
File
.
open
(
uploaded_image_temp_path
))
project
=
create
(
:
empty_
project
,
avatar:
File
.
open
(
uploaded_image_temp_path
))
avatar_url
=
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}
/uploads/project/avatar/
#{
project
.
id
}
/banana_sample.gif"
avatar_url
=
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}
/uploads/project/avatar/
#{
project
.
id
}
/banana_sample.gif"
expect
(
helper
.
project_icon
(
"
#{
project
.
namespace
.
to_param
}
/
#{
project
.
to_param
}
"
).
to_s
).
expect
(
helper
.
project_icon
(
"
#{
project
.
namespace
.
to_param
}
/
#{
project
.
to_param
}
"
).
to_s
).
...
@@ -63,7 +63,7 @@ describe ApplicationHelper do
...
@@ -63,7 +63,7 @@ describe ApplicationHelper do
end
end
it
'gives uploaded icon when present'
do
it
'gives uploaded icon when present'
do
project
=
create
(
:project
)
project
=
create
(
:
empty_
project
)
allow_any_instance_of
(
Project
).
to
receive
(
:avatar_in_git
).
and_return
(
true
)
allow_any_instance_of
(
Project
).
to
receive
(
:avatar_in_git
).
and_return
(
true
)
...
...
spec/helpers/blob_helper_spec.rb
浏览文件 @
3a0d9314
...
@@ -70,7 +70,7 @@ describe BlobHelper do
...
@@ -70,7 +70,7 @@ describe BlobHelper do
describe
"#edit_blob_link"
do
describe
"#edit_blob_link"
do
let
(
:namespace
)
{
create
(
:namespace
,
name:
'gitlab'
)}
let
(
:namespace
)
{
create
(
:namespace
,
name:
'gitlab'
)}
let
(
:project
)
{
create
(
:project
,
namespace:
namespace
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
namespace
)
}
before
do
before
do
allow
(
self
).
to
receive
(
:current_user
).
and_return
(
double
)
allow
(
self
).
to
receive
(
:current_user
).
and_return
(
double
)
...
...
spec/helpers/gitlab_markdown_helper_spec.rb
浏览文件 @
3a0d9314
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
GitlabMarkdownHelper
do
describe
GitlabMarkdownHelper
do
include
ApplicationHelper
include
ApplicationHelper
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
,
username:
'gfm'
)
}
let
(
:user
)
{
create
(
:user
,
username:
'gfm'
)
}
let
(
:commit
)
{
project
.
commit
}
let
(
:commit
)
{
project
.
commit
}
...
@@ -55,18 +55,19 @@ describe GitlabMarkdownHelper do
...
@@ -55,18 +55,19 @@ describe GitlabMarkdownHelper do
end
end
describe
'#link_to_gfm'
do
describe
'#link_to_gfm'
do
let
(
:commit_path
)
{
namespace_project_commit_path
(
project
.
namespace
,
project
,
commit
)
}
let
(
:link
)
{
'/commits/0a1b2c3d'
}
let
(
:issues
)
{
create_list
(
:issue
,
2
,
project:
project
)
}
let
(
:issues
)
{
create_list
(
:issue
,
2
)
}
let
(
:project
)
{
issues
.
first
.
project
}
it
'handles references nested in links with all the text'
do
it
'handles references nested in links with all the text'
do
actual
=
helper
.
link_to_gfm
(
"This should finally fix
#{
issues
[
0
].
to_reference
}
and
#{
issues
[
1
].
to_reference
}
for real"
,
commit_path
)
actual
=
helper
.
link_to_gfm
(
"This should finally fix
#{
issues
[
0
].
to_reference
}
and
#{
issues
[
1
].
to_reference
}
for real"
,
link
)
doc
=
Nokogiri
::
HTML
.
parse
(
actual
)
doc
=
Nokogiri
::
HTML
.
parse
(
actual
)
# Make sure we didn't create invalid markup
# Make sure we didn't create invalid markup
expect
(
doc
.
errors
).
to
be_empty
expect
(
doc
.
errors
).
to
be_empty
# Leading commit link
# Leading commit link
expect
(
doc
.
css
(
'a'
)[
0
].
attr
(
'href'
)).
to
eq
commit_path
expect
(
doc
.
css
(
'a'
)[
0
].
attr
(
'href'
)).
to
eq
link
expect
(
doc
.
css
(
'a'
)[
0
].
text
).
to
eq
'This should finally fix '
expect
(
doc
.
css
(
'a'
)[
0
].
text
).
to
eq
'This should finally fix '
# First issue link
# First issue link
...
@@ -75,7 +76,7 @@ describe GitlabMarkdownHelper do
...
@@ -75,7 +76,7 @@ describe GitlabMarkdownHelper do
expect
(
doc
.
css
(
'a'
)[
1
].
text
).
to
eq
issues
[
0
].
to_reference
expect
(
doc
.
css
(
'a'
)[
1
].
text
).
to
eq
issues
[
0
].
to_reference
# Internal commit link
# Internal commit link
expect
(
doc
.
css
(
'a'
)[
2
].
attr
(
'href'
)).
to
eq
commit_path
expect
(
doc
.
css
(
'a'
)[
2
].
attr
(
'href'
)).
to
eq
link
expect
(
doc
.
css
(
'a'
)[
2
].
text
).
to
eq
' and '
expect
(
doc
.
css
(
'a'
)[
2
].
text
).
to
eq
' and '
# Second issue link
# Second issue link
...
@@ -84,12 +85,12 @@ describe GitlabMarkdownHelper do
...
@@ -84,12 +85,12 @@ describe GitlabMarkdownHelper do
expect
(
doc
.
css
(
'a'
)[
3
].
text
).
to
eq
issues
[
1
].
to_reference
expect
(
doc
.
css
(
'a'
)[
3
].
text
).
to
eq
issues
[
1
].
to_reference
# Trailing commit link
# Trailing commit link
expect
(
doc
.
css
(
'a'
)[
4
].
attr
(
'href'
)).
to
eq
commit_path
expect
(
doc
.
css
(
'a'
)[
4
].
attr
(
'href'
)).
to
eq
link
expect
(
doc
.
css
(
'a'
)[
4
].
text
).
to
eq
' for real'
expect
(
doc
.
css
(
'a'
)[
4
].
text
).
to
eq
' for real'
end
end
it
'forwards HTML options'
do
it
'forwards HTML options'
do
actual
=
helper
.
link_to_gfm
(
"Fixed in
#{
commit
.
id
}
"
,
commit_path
,
class:
'foo'
)
actual
=
helper
.
link_to_gfm
(
"Fixed in
#{
commit
.
id
}
"
,
link
,
class:
'foo'
)
doc
=
Nokogiri
::
HTML
.
parse
(
actual
)
doc
=
Nokogiri
::
HTML
.
parse
(
actual
)
expect
(
doc
.
css
(
'a'
)).
to
satisfy
do
|
v
|
expect
(
doc
.
css
(
'a'
)).
to
satisfy
do
|
v
|
...
@@ -100,7 +101,7 @@ describe GitlabMarkdownHelper do
...
@@ -100,7 +101,7 @@ describe GitlabMarkdownHelper do
it
"escapes HTML passed in as the body"
do
it
"escapes HTML passed in as the body"
do
actual
=
"This is a <h1>test</h1> - see
#{
issues
[
0
].
to_reference
}
"
actual
=
"This is a <h1>test</h1> - see
#{
issues
[
0
].
to_reference
}
"
expect
(
helper
.
link_to_gfm
(
actual
,
commit_path
)).
expect
(
helper
.
link_to_gfm
(
actual
,
link
)).
to
match
(
'<h1>test</h1>'
)
to
match
(
'<h1>test</h1>'
)
end
end
...
...
spec/helpers/graph_helper_spec.rb
浏览文件 @
3a0d9314
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
GraphHelper
do
describe
GraphHelper
do
describe
'#get_refs'
do
describe
'#get_refs'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:commit
)
{
project
.
commit
(
"master"
)
}
let
(
:commit
)
{
project
.
commit
(
"master"
)
}
let
(
:graph
)
{
Network
::
Graph
.
new
(
project
,
'master'
,
commit
,
''
)
}
let
(
:graph
)
{
Network
::
Graph
.
new
(
project
,
'master'
,
commit
,
''
)
}
...
...
spec/helpers/issues_helper_spec.rb
浏览文件 @
3a0d9314
require
"spec_helper"
require
"spec_helper"
describe
IssuesHelper
do
describe
IssuesHelper
do
let
(
:project
)
{
create
:project
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:issue
)
{
create
:issue
,
project:
project
}
let
(
:issue
)
{
create
:issue
,
project:
project
}
let
(
:ext_project
)
{
create
:redmine_project
}
let
(
:ext_project
)
{
create
:redmine_project
}
...
...
spec/helpers/members_helper_spec.rb
浏览文件 @
3a0d9314
...
@@ -46,7 +46,7 @@ describe MembersHelper do
...
@@ -46,7 +46,7 @@ describe MembersHelper do
end
end
describe
'#leave_confirmation_message'
do
describe
'#leave_confirmation_message'
do
let
(
:project
)
{
build_stubbed
(
:project
)
}
let
(
:project
)
{
build_stubbed
(
:
empty_
project
)
}
let
(
:group
)
{
build_stubbed
(
:group
)
}
let
(
:group
)
{
build_stubbed
(
:group
)
}
let
(
:user
)
{
build_stubbed
(
:user
)
}
let
(
:user
)
{
build_stubbed
(
:user
)
}
...
...
spec/helpers/merge_requests_helper_spec.rb
浏览文件 @
3a0d9314
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
MergeRequestsHelper
do
describe
MergeRequestsHelper
do
describe
'ci_build_details_path'
do
describe
'ci_build_details_path'
do
let
(
:project
)
{
create
:project
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:merge_request
)
{
MergeRequest
.
new
}
let
(
:merge_request
)
{
MergeRequest
.
new
}
let
(
:ci_service
)
{
CiService
.
new
}
let
(
:ci_service
)
{
CiService
.
new
}
let
(
:last_commit
)
{
Ci
::
Pipeline
.
new
({})
}
let
(
:last_commit
)
{
Ci
::
Pipeline
.
new
({})
}
...
@@ -30,7 +30,7 @@ describe MergeRequestsHelper do
...
@@ -30,7 +30,7 @@ describe MergeRequestsHelper do
it
{
is_expected
.
to
eq
(
'#1, #2, and #3'
)
}
it
{
is_expected
.
to
eq
(
'#1, #2, and #3'
)
}
context
'for JIRA issues'
do
context
'for JIRA issues'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:issues
)
do
let
(
:issues
)
do
[
[
ExternalIssue
.
new
(
'JIRA-123'
,
project
),
ExternalIssue
.
new
(
'JIRA-123'
,
project
),
...
@@ -52,8 +52,8 @@ describe MergeRequestsHelper do
...
@@ -52,8 +52,8 @@ describe MergeRequestsHelper do
end
end
describe
'within different projects'
do
describe
'within different projects'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
)
}
let
(
:fork_project
)
{
create
(
:
empty_
project
,
forked_from_project:
project
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
fork_project
,
target_project:
project
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
fork_project
,
target_project:
project
)
}
subject
{
format_mr_branch_names
(
merge_request
)
}
subject
{
format_mr_branch_names
(
merge_request
)
}
let
(
:source_title
)
{
"
#{
fork_project
.
path_with_namespace
}
:
#{
merge_request
.
source_branch
}
"
}
let
(
:source_title
)
{
"
#{
fork_project
.
path_with_namespace
}
:
#{
merge_request
.
source_branch
}
"
}
...
@@ -64,8 +64,8 @@ describe MergeRequestsHelper do
...
@@ -64,8 +64,8 @@ describe MergeRequestsHelper do
end
end
describe
'mr_widget_refresh_url'
do
describe
'mr_widget_refresh_url'
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
let
(
:project
)
{
create
(
:project
)
}
it
'returns correct url for MR'
do
it
'returns correct url for MR'
do
expected_url
=
"
#{
project
.
path_with_namespace
}
/merge_requests/
#{
merge_request
.
iid
}
/merge_widget_refresh"
expected_url
=
"
#{
project
.
path_with_namespace
}
/merge_requests/
#{
merge_request
.
iid
}
/merge_widget_refresh"
...
...
spec/helpers/milestones_helper_spec.rb
浏览文件 @
3a0d9314
...
@@ -21,24 +21,22 @@ describe MilestonesHelper do
...
@@ -21,24 +21,22 @@ describe MilestonesHelper do
end
end
describe
'#milestone_counts'
do
describe
'#milestone_counts'
do
let
(
:project
)
{
FactoryGirl
.
create
(
:
project
)
}
let
(
:project
)
{
create
(
:empty_
project
)
}
let
(
:counts
)
{
helper
.
milestone_counts
(
project
.
milestones
)
}
let
(
:counts
)
{
helper
.
milestone_counts
(
project
.
milestones
)
}
context
'when there are milestones'
do
context
'when there are milestones'
do
let!
(
:milestone_1
)
{
FactoryGirl
.
create
(
:active_milestone
,
project:
project
)
}
let!
(
:milestone_2
)
{
FactoryGirl
.
create
(
:active_milestone
,
project:
project
)
}
let!
(
:milestone_3
)
{
FactoryGirl
.
create
(
:closed_milestone
,
project:
project
)
}
it
'returns the correct counts'
do
it
'returns the correct counts'
do
create_list
(
:active_milestone
,
2
,
project:
project
)
create
(
:closed_milestone
,
project:
project
)
expect
(
counts
).
to
eq
(
opened:
2
,
closed:
1
,
all:
3
)
expect
(
counts
).
to
eq
(
opened:
2
,
closed:
1
,
all:
3
)
end
end
end
end
context
'when there are only milestones of one type'
do
context
'when there are only milestones of one type'
do
let!
(
:milestone_1
)
{
FactoryGirl
.
create
(
:active_milestone
,
project:
project
)
}
let!
(
:milestone_2
)
{
FactoryGirl
.
create
(
:active_milestone
,
project:
project
)
}
it
'returns the correct counts'
do
it
'returns the correct counts'
do
create_list
(
:active_milestone
,
2
,
project:
project
)
expect
(
counts
).
to
eq
(
opened:
2
,
closed:
0
,
all:
2
)
expect
(
counts
).
to
eq
(
opened:
2
,
closed:
0
,
all:
2
)
end
end
end
end
...
...
spec/helpers/preferences_helper_spec.rb
浏览文件 @
3a0d9314
...
@@ -110,7 +110,7 @@ describe PreferencesHelper do
...
@@ -110,7 +110,7 @@ describe PreferencesHelper do
end
end
context
'when repository is not empty'
do
context
'when repository is not empty'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
it
'returns readme if user has repository access'
do
it
'returns readme if user has repository access'
do
allow
(
helper
).
to
receive
(
:can?
).
with
(
nil
,
:download_code
,
project
).
and_return
(
true
)
allow
(
helper
).
to
receive
(
:can?
).
with
(
nil
,
:download_code
,
project
).
and_return
(
true
)
...
...
spec/helpers/projects_helper_spec.rb
浏览文件 @
3a0d9314
...
@@ -10,7 +10,7 @@ describe ProjectsHelper do
...
@@ -10,7 +10,7 @@ describe ProjectsHelper do
end
end
describe
"can_change_visibility_level?"
do
describe
"can_change_visibility_level?"
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:project_member
,
:reporter
,
user:
create
(
:user
),
project:
project
).
user
}
let
(
:user
)
{
create
(
:project_member
,
:reporter
,
user:
create
(
:user
),
project:
project
).
user
}
let
(
:fork_project
)
{
Projects
::
ForkService
.
new
(
project
,
user
).
execute
}
let
(
:fork_project
)
{
Projects
::
ForkService
.
new
(
project
,
user
).
execute
}
...
@@ -97,7 +97,7 @@ describe ProjectsHelper do
...
@@ -97,7 +97,7 @@ describe ProjectsHelper do
end
end
describe
'#license_short_name'
do
describe
'#license_short_name'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
context
'when project.repository has a license_key'
do
context
'when project.repository has a license_key'
do
it
'returns the nickname of the license if present'
do
it
'returns the nickname of the license if present'
do
...
...
spec/helpers/search_helper_spec.rb
浏览文件 @
3a0d9314
...
@@ -42,7 +42,7 @@ describe SearchHelper do
...
@@ -42,7 +42,7 @@ describe SearchHelper do
end
end
it
"includes the user's projects"
do
it
"includes the user's projects"
do
project
=
create
(
:project
,
namespace:
create
(
:namespace
,
owner:
user
))
project
=
create
(
:
empty_
project
,
namespace:
create
(
:namespace
,
owner:
user
))
expect
(
search_autocomplete_opts
(
project
.
name
).
size
).
to
eq
(
1
)
expect
(
search_autocomplete_opts
(
project
.
name
).
size
).
to
eq
(
1
)
end
end
...
@@ -52,7 +52,9 @@ describe SearchHelper do
...
@@ -52,7 +52,9 @@ describe SearchHelper do
end
end
context
"with a current project"
do
context
"with a current project"
do
before
{
@project
=
create
(
:project
)
}
before
do
@project
=
create
(
:project
,
:repository
)
end
it
"includes project-specific sections"
do
it
"includes project-specific sections"
do
expect
(
search_autocomplete_opts
(
"Files"
).
size
).
to
eq
(
1
)
expect
(
search_autocomplete_opts
(
"Files"
).
size
).
to
eq
(
1
)
...
...
spec/helpers/submodule_helper_spec.rb
浏览文件 @
3a0d9314
...
@@ -116,7 +116,7 @@ describe SubmoduleHelper do
...
@@ -116,7 +116,7 @@ describe SubmoduleHelper do
context
'submodules with relative links'
do
context
'submodules with relative links'
do
let
(
:group
)
{
create
(
:group
,
name:
"Master Project"
,
path:
"master-project"
)
}
let
(
:group
)
{
create
(
:group
,
name:
"Master Project"
,
path:
"master-project"
)
}
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
group:
group
)
}
let
(
:commit_id
)
{
sample_commit
[
:id
]
}
let
(
:commit_id
)
{
sample_commit
[
:id
]
}
before
do
before
do
...
@@ -145,7 +145,7 @@ describe SubmoduleHelper do
...
@@ -145,7 +145,7 @@ describe SubmoduleHelper do
context
'personal project'
do
context
'personal project'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
namespace:
user
.
namespace
)
}
it
'one level down with personal project'
do
it
'one level down with personal project'
do
result
=
relative_self_links
(
'../test.git'
,
commit_id
)
result
=
relative_self_links
(
'../test.git'
,
commit_id
)
...
...
spec/helpers/tree_helper_spec.rb
浏览文件 @
3a0d9314
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
TreeHelper
do
describe
TreeHelper
do
describe
'flatten_tree'
do
describe
'flatten_tree'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
before
do
before
do
@repository
=
project
.
repository
@repository
=
project
.
repository
...
...
spec/helpers/visibility_level_helper_spec.rb
浏览文件 @
3a0d9314
require
'spec_helper'
require
'spec_helper'
describe
VisibilityLevelHelper
do
describe
VisibilityLevelHelper
do
let
(
:project
)
{
build
(
:project
)
}
let
(
:project
)
{
build
(
:
empty_
project
)
}
let
(
:group
)
{
build
(
:group
)
}
let
(
:group
)
{
build
(
:group
)
}
let
(
:personal_snippet
)
{
build
(
:personal_snippet
)
}
let
(
:personal_snippet
)
{
build
(
:personal_snippet
)
}
let
(
:project_snippet
)
{
build
(
:project_snippet
)
}
let
(
:project_snippet
)
{
build
(
:project_snippet
)
}
...
@@ -60,8 +60,8 @@ describe VisibilityLevelHelper do
...
@@ -60,8 +60,8 @@ describe VisibilityLevelHelper do
describe
"skip_level?"
do
describe
"skip_level?"
do
describe
"forks"
do
describe
"forks"
do
let
(
:project
)
{
create
(
:project
,
:internal
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:internal
)
}
let
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
)
}
let
(
:fork_project
)
{
create
(
:
empty_
project
,
forked_from_project:
project
)
}
it
"skips levels"
do
it
"skips levels"
do
expect
(
skip_level?
(
fork_project
,
Gitlab
::
VisibilityLevel
::
PUBLIC
)).
to
be_truthy
expect
(
skip_level?
(
fork_project
,
Gitlab
::
VisibilityLevel
::
PUBLIC
)).
to
be_truthy
...
@@ -71,7 +71,7 @@ describe VisibilityLevelHelper do
...
@@ -71,7 +71,7 @@ describe VisibilityLevelHelper do
end
end
describe
"non-forked project"
do
describe
"non-forked project"
do
let
(
:project
)
{
create
(
:project
,
:internal
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:internal
)
}
it
"skips levels"
do
it
"skips levels"
do
expect
(
skip_level?
(
project
,
Gitlab
::
VisibilityLevel
::
PUBLIC
)).
to
be_falsey
expect
(
skip_level?
(
project
,
Gitlab
::
VisibilityLevel
::
PUBLIC
)).
to
be_falsey
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录