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
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
Show 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 @@ class Note < ActiveRecord::Base
# 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 @@ class Note < ActiveRecord::Base
# 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 @@ describe Note do
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 @@ describe Note do
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