Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GitLab
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
projects.thm.de
GitLab
Commits
64efc052
Commit
64efc052
authored
Nov 28, 2013
by
vagrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added thumbsup and thumsdown emoji voting with rspec tests
parent
2e07865f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
app/models/note.rb
app/models/note.rb
+4
-2
spec/models/note_spec.rb
spec/models/note_spec.rb
+10
-0
No files found.
app/models/note.rb
View file @
64efc052
...
...
@@ -157,7 +157,8 @@ def discussion_id
# otherwise false is returned
def
downvote?
votable?
&&
(
note
.
start_with?
(
'-1'
)
||
note
.
start_with?
(
':-1:'
)
note
.
start_with?
(
':-1:'
)
||
note
.
start_with?
(
':thumbsdown:'
)
)
end
...
...
@@ -206,7 +207,8 @@ def noteable
# otherwise false is returned
def
upvote?
votable?
&&
(
note
.
start_with?
(
'+1'
)
||
note
.
start_with?
(
':+1:'
)
note
.
start_with?
(
':+1:'
)
||
note
.
start_with?
(
':thumbsup:'
)
)
end
...
...
spec/models/note_spec.rb
View file @
64efc052
...
...
@@ -61,6 +61,11 @@
note
.
should
be_upvote
end
it
"recognizes a thumbsup emoji as a vote"
do
note
=
build
(
:votable_note
,
note:
":thumbsup: for this"
)
note
.
should
be_upvote
end
it
"recognizes a -1 note"
do
note
=
create
(
:votable_note
,
note:
"-1 for this"
)
note
.
should
be_downvote
...
...
@@ -70,6 +75,11 @@
note
=
build
(
:votable_note
,
note:
":-1: for this"
)
note
.
should
be_downvote
end
it
"recognizes a thumbsdown emoji as a vote"
do
note
=
build
(
:votable_note
,
note:
":thumbsdown: for this"
)
note
.
should
be_downvote
end
end
let
(
:project
)
{
create
(
:project
)
}
...
...
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