Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
710bfde3
Commit
710bfde3
authored
Sep 08, 2021
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make AwardEmojiPresenter rely on TanukiEmoji
parent
036f3297
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
app/presenters/award_emoji_presenter.rb
app/presenters/award_emoji_presenter.rb
+4
-4
spec/presenters/award_emoji_presenter_spec.rb
spec/presenters/award_emoji_presenter_spec.rb
+4
-3
No files found.
app/presenters/award_emoji_presenter.rb
View file @
710bfde3
...
...
@@ -4,15 +4,15 @@ class AwardEmojiPresenter < Gitlab::View::Presenter::Delegated
presents
::
AwardEmoji
,
as: :award_emoji
def
description
as_emoji
[
'description'
]
as_emoji
&
.
description
end
def
unicode
as_emoji
[
'unicode'
]
as_emoji
&
.
hex
end
def
emoji
as_emoji
[
'moji'
]
as_emoji
&
.
codepoints
end
def
unicode_version
...
...
@@ -22,6 +22,6 @@ class AwardEmojiPresenter < Gitlab::View::Presenter::Delegated
private
def
as_emoji
@emoji
||=
Gitlab
::
Emoji
.
emojis
[
award_emoji
.
name
]
||
{}
@emoji
||=
TanukiEmoji
.
find_by_alpha_code
(
award_emoji
.
name
)
end
end
spec/presenters/award_emoji_presenter_spec.rb
View file @
710bfde3
...
...
@@ -6,13 +6,14 @@ RSpec.describe AwardEmojiPresenter do
let
(
:emoji_name
)
{
'thumbsup'
}
let
(
:award_emoji
)
{
build
(
:award_emoji
,
name:
emoji_name
)
}
let
(
:presenter
)
{
described_class
.
new
(
award_emoji
)
}
let
(
:emoji
)
{
TanukiEmoji
.
find_by_alpha_code
(
emoji_name
)
}
describe
'#description'
do
it
{
expect
(
presenter
.
description
).
to
eq
Gitlab
::
Emoji
.
emojis
[
emoji_name
][
'description'
]
}
it
{
expect
(
presenter
.
description
).
to
eq
emoji
.
description
}
end
describe
'#unicode'
do
it
{
expect
(
presenter
.
unicode
).
to
eq
Gitlab
::
Emoji
.
emojis
[
emoji_name
][
'unicode'
]
}
it
{
expect
(
presenter
.
unicode
).
to
eq
emoji
.
hex
}
end
describe
'#unicode_version'
do
...
...
@@ -20,7 +21,7 @@ RSpec.describe AwardEmojiPresenter do
end
describe
'#emoji'
do
it
{
expect
(
presenter
.
emoji
).
to
eq
Gitlab
::
Emoji
.
emojis
[
emoji_name
][
'moji'
]
}
it
{
expect
(
presenter
.
emoji
).
to
eq
emoji
.
codepoints
}
end
describe
'when presenting an award emoji with an invalid name'
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