Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cs_comments_service
Overview
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
cs_comments_service
Commits
577fccab
Commit
577fccab
authored
Apr 05, 2013
by
Kevin Chugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed tests
parent
87713149
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
8 deletions
+19
-8
spec/api/abuse_spec.rb
+19
-8
No files found.
spec/api/abuse_spec.rb
View file @
577fccab
...
@@ -12,8 +12,8 @@ def remove_thread_flag(thread_id, user_id)
...
@@ -12,8 +12,8 @@ def remove_thread_flag(thread_id, user_id)
remove_flag
(
"/api/v1/threads/"
+
thread_id
+
"/abuse_unflags"
,
user_id
)
remove_flag
(
"/api/v1/threads/"
+
thread_id
+
"/abuse_unflags"
,
user_id
)
end
end
def
remove_comment_flag
(
thread
_id
,
user_id
)
def
remove_comment_flag
(
comment
_id
,
user_id
)
remove_flag
(
"/api/v1/
thread
s/"
+
comment_id
+
"/abuse_unflags"
,
user_id
)
remove_flag
(
"/api/v1/
comment
s/"
+
comment_id
+
"/abuse_unflags"
,
user_id
)
end
end
def
create_flag
(
put_command
,
user_id
)
def
create_flag
(
put_command
,
user_id
)
...
@@ -24,6 +24,14 @@ def create_flag(put_command, user_id)
...
@@ -24,6 +24,14 @@ def create_flag(put_command, user_id)
end
end
end
end
def
remove_flag
(
put_command
,
user_id
)
if
user_id
.
nil?
put
put_command
else
put
put_command
,
user_id:
user_id
end
end
describe
"app"
do
describe
"app"
do
describe
"abuse"
do
describe
"abuse"
do
before
(
:each
)
{
init_without_subscriptions
}
before
(
:each
)
{
init_without_subscriptions
}
...
@@ -81,15 +89,18 @@ describe "app" do
...
@@ -81,15 +89,18 @@ describe "app" do
describe
"unflag a comment as abusive"
do
describe
"unflag a comment as abusive"
do
it
"removes the user from the existing abuse_flaggers"
do
it
"removes the user from the existing abuse_flaggers"
do
comment
=
Comment
.
first
comment
=
Comment
.
first
thread
=
comment
.
comment_thread
create_comment_flag
(
"
#{
comment
.
id
}
"
,
User
.
first
.
id
)
prev_abuse_flaggers
=
thread
.
abuse_flaggers
create_thread_flag
(
"
#{
thread
.
id
}
"
,
User
.
first
.
id
)
comment
=
Comment
.
first
prev_abuse_flaggers
=
comment
.
abuse_flaggers
prev_abuse_flaggers
.
should
include
User
.
first
.
id
prev_abuse_flaggers
.
should
include
User
.
first
.
id
remove_thread_flag
(
"
#{
thread
.
id
}
"
,
User
.
first
.
id
)
remove_comment_flag
(
"
#{
comment
.
id
}
"
,
User
.
first
.
id
)
comment
=
Comment
.
find
(
comment
.
id
)
comment
=
Comment
.
find
(
comment
.
id
)
comment
.
comment_thread
.
abuse_flaggers
.
length
.
should
==
prev_abuse_flaggers
.
length
+
1
comment
.
abuse_flaggers
.
length
.
should
==
prev_abuse_flaggers
.
length
-
1
prev_abuse_flaggers
.
should_not
include
?
User
.
first
.
id
comment
.
abuse_flaggers
.
to_a
.
should_not
include
User
.
first
.
id
end
end
it
"returns 400 when the thread does not exist"
do
it
"returns 400 when the thread does not exist"
do
remove_thread_flag
(
"does_not_exist"
,
User
.
first
.
id
)
remove_thread_flag
(
"does_not_exist"
,
User
.
first
.
id
)
...
...
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