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
06c1a8a9
Commit
06c1a8a9
authored
Sep 08, 2012
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make notes recognize downvotes
parent
cc7c6d53
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
8 deletions
+21
-8
app/models/note.rb
app/models/note.rb
+6
-0
spec/models/note_spec.rb
spec/models/note_spec.rb
+15
-8
No files found.
app/models/note.rb
View file @
06c1a8a9
...
@@ -105,6 +105,12 @@ class Note < ActiveRecord::Base
...
@@ -105,6 +105,12 @@ class Note < ActiveRecord::Base
def
upvote?
def
upvote?
note
.
start_with?
(
'+1'
)
||
note
.
start_with?
(
':+1:'
)
note
.
start_with?
(
'+1'
)
||
note
.
start_with?
(
':+1:'
)
end
end
# Returns true if this is a downvote note,
# otherwise false is returned
def
downvote?
note
.
start_with?
(
'-1'
)
||
note
.
start_with?
(
':-1:'
)
end
end
end
# == Schema Information
# == Schema Information
#
#
...
...
spec/models/note_spec.rb
View file @
06c1a8a9
...
@@ -24,6 +24,13 @@ describe Note do
...
@@ -24,6 +24,13 @@ describe Note do
it
"recognizes a neutral note"
do
it
"recognizes a neutral note"
do
note
=
Factory
(
:note
,
note:
"This is not a +1 note"
)
note
=
Factory
(
:note
,
note:
"This is not a +1 note"
)
note
.
should_not
be_upvote
note
.
should_not
be_upvote
note
.
should_not
be_downvote
end
it
"recognizes a neutral emoji note"
do
note
=
build
(
:note
,
note:
"I would :+1: this, but I don't want to"
)
note
.
should_not
be_upvote
note
.
should_not
be_downvote
end
end
it
"recognizes a +1 note"
do
it
"recognizes a +1 note"
do
...
@@ -31,19 +38,19 @@ describe Note do
...
@@ -31,19 +38,19 @@ describe Note do
note
.
should
be_upvote
note
.
should
be_upvote
end
end
it
"recognizes a -1 note as no vote"
do
note
=
Factory
(
:note
,
note:
"-1 for this"
)
note
.
should_not
be_upvote
end
it
"recognizes a +1 emoji as a vote"
do
it
"recognizes a +1 emoji as a vote"
do
note
=
build
(
:note
,
note:
":+1: for this"
)
note
=
build
(
:note
,
note:
":+1: for this"
)
note
.
should
be_upvote
note
.
should
be_upvote
end
end
it
"recognizes a neutral emoji note"
do
it
"recognizes a -1 note"
do
note
=
build
(
:note
,
note:
"I would :+1: this, but I don't want to"
)
note
=
Factory
(
:note
,
note:
"-1 for this"
)
note
.
should_not
be_upvote
note
.
should
be_downvote
end
it
"recognizes a -1 emoji as a vote"
do
note
=
build
(
:note
,
note:
":-1: for this"
)
note
.
should
be_downvote
end
end
end
end
...
...
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