Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
f1ace97f
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 搜索 >>
提交
f1ace97f
编写于
5月 03, 2017
作者:
R
Rémy Coutable
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Backport avatar-related spec changes from gitlab-org/gitlab-ee@4b464eaaee
Signed-off-by:
N
Rémy Coutable
<
remy@rymai.me
>
上级
d3768dd7
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
38 addition
and
8 deletion
+38
-8
spec/factories/groups.rb
spec/factories/groups.rb
+4
-0
spec/factories/users.rb
spec/factories/users.rb
+4
-0
spec/models/group_spec.rb
spec/models/group_spec.rb
+16
-0
spec/models/project_spec.rb
spec/models/project_spec.rb
+3
-8
spec/models/user_spec.rb
spec/models/user_spec.rb
+11
-0
未找到文件。
spec/factories/groups.rb
浏览文件 @
f1ace97f
...
...
@@ -17,6 +17,10 @@ FactoryGirl.define do
visibility_level
Gitlab
::
VisibilityLevel
::
PRIVATE
end
trait
:with_avatar
do
avatar
{
File
.
open
(
Rails
.
root
.
join
(
'spec/fixtures/dk.png'
))
}
end
trait
:access_requestable
do
request_access_enabled
true
end
...
...
spec/factories/users.rb
浏览文件 @
f1ace97f
...
...
@@ -29,6 +29,10 @@ FactoryGirl.define do
after
(
:build
)
{
|
user
,
_
|
user
.
block!
}
end
trait
:with_avatar
do
avatar
{
File
.
open
(
Rails
.
root
.
join
(
'spec/fixtures/dk.png'
))
}
end
trait
:two_factor_via_otp
do
before
(
:create
)
do
|
user
|
user
.
otp_required_for_login
=
true
...
...
spec/models/group_spec.rb
浏览文件 @
f1ace97f
...
...
@@ -175,6 +175,22 @@ describe Group, models: true do
end
end
describe
'#avatar_url'
do
let!
(
:group
)
{
create
(
:group
,
:access_requestable
,
:with_avatar
)
}
let
(
:user
)
{
create
(
:user
)
}
subject
{
group
.
avatar_url
}
context
'when avatar file is uploaded'
do
before
do
group
.
add_master
(
user
)
end
let
(
:avatar_path
)
{
"/uploads/group/avatar/
#{
group
.
id
}
/dk.png"
}
it
{
should
eq
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}#{
avatar_path
}
"
}
end
end
describe
'.search'
do
it
'returns groups with a matching name'
do
expect
(
described_class
.
search
(
group
.
name
)).
to
eq
([
group
])
...
...
spec/models/project_spec.rb
浏览文件 @
f1ace97f
...
...
@@ -811,12 +811,9 @@ describe Project, models: true do
context
'when avatar file is uploaded'
do
let
(
:project
)
{
create
(
:empty_project
,
:with_avatar
)
}
let
(
:avatar_path
)
{
"/uploads/project/avatar/
#{
project
.
id
}
/dk.png"
}
it
'creates a correct avatar path'
do
avatar_path
=
"/uploads/project/avatar/
#{
project
.
id
}
/dk.png"
expect
(
project
.
avatar_url
).
to
eq
(
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}#{
avatar_path
}
"
)
end
it
{
should
eq
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}#{
avatar_path
}
"
}
end
context
'When avatar file in git'
do
...
...
@@ -824,9 +821,7 @@ describe Project, models: true do
allow
(
project
).
to
receive
(
:avatar_in_git
)
{
true
}
end
let
(
:avatar_path
)
do
"/
#{
project
.
full_path
}
/avatar"
end
let
(
:avatar_path
)
{
"/
#{
project
.
full_path
}
/avatar"
}
it
{
should
eq
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}#{
avatar_path
}
"
}
end
...
...
spec/models/user_spec.rb
浏览文件 @
f1ace97f
...
...
@@ -874,6 +874,17 @@ describe User, models: true do
end
end
describe
'#avatar_url'
do
let
(
:user
)
{
create
(
:user
,
:with_avatar
)
}
subject
{
user
.
avatar_url
}
context
'when avatar file is uploaded'
do
let
(
:avatar_path
)
{
"/uploads/user/avatar/
#{
user
.
id
}
/dk.png"
}
it
{
should
eq
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}#{
avatar_path
}
"
}
end
end
describe
'#requires_ldap_check?'
do
let
(
:user
)
{
User
.
new
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录