BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
0963ac36
Unverified
Commit
0963ac36
authored
Sep 05, 2017
by
Maxim Rydkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix helper and spec
parent
c9d76b52
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
projects_helper.rb
app/helpers/projects_helper.rb
+5
-1
projects_helper_spec.rb
spec/helpers/projects_helper_spec.rb
+8
-5
No files found.
app/helpers/projects_helper.rb
View file @
0963ac36
...
...
@@ -17,7 +17,11 @@ module ProjectsHelper
def
link_to_member_avatar
(
author
,
opts
=
{})
default_opts
=
{
avatar:
true
,
name:
true
,
size:
16
,
author_class:
'author'
,
title:
":name"
}
opts
=
default_opts
.
merge
(
opts
)
image_tag
(
avatar_icon
(
author
,
opts
[
:size
]),
width:
opts
[
:size
],
class:
[
'avatar'
,
'avatar-inline'
,
"
#{
"s
#{
opts
[
:size
]
}
"
if
opts
[
:size
]
}
"
,
opts
[
:avatar_class
]].
reject
(
&
:blank?
),
alt:
''
)
if
opts
[
:avatar
]
classes
=
%w[avatar avatar-inline]
classes
<<
"s
#{
opts
[
:size
]
}
"
classes
<<
opts
[
:avatar_class
]
if
opts
[
:avatar_class
]
image_tag
(
avatar_icon
(
author
,
opts
[
:size
]),
width:
opts
[
:size
],
class:
classes
,
alt:
''
)
if
opts
[
:avatar
]
end
def
link_to_member
(
project
,
author
,
opts
=
{},
&
block
)
...
...
spec/helpers/projects_helper_spec.rb
View file @
0963ac36
...
...
@@ -192,17 +192,20 @@ describe ProjectsHelper do
end
describe
'#link_to_member_avatar'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
build_stubbed
(
:user
)
}
it
'returns image tag for member avatar'
do
expect
(
helper
.
link_to_member_avatar
(
user
)).
to
eq
(
"<img width=
\"
16
\"
class=
\"
avatar avatar-inline s16 lazy
\"
alt=
\"\"
data-src=
\"
http://www.gravatar.com/avatar/a763e4acc6bc22cbabeae2638cfd4db4?s=32&d=identicon
\"
src=
\"
data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
\"
/>"
)
allow
(
helper
).
to
receive
(
:image_tag
).
with
(
nil
,
{
width:
16
,
class:
[
"avatar"
,
"avatar-inline"
,
"s16"
],
alt:
""
})
allow
(
helper
).
to
receive
(
:avatar_icon
).
with
(
user
,
16
)
helper
.
link_to_member_avatar
(
user
)
end
end
describe
'#link_to_member'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
build_stubbed
(
:group
)
}
let
(
:project
)
{
build_stubbed
(
:project
,
group:
group
)
}
let
(
:user
)
{
build_stubbed
(
:user
)
}
describe
'using the default options'
do
it
'returns an HTML link to the user'
do
...
...
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