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
1f59831e
Commit
1f59831e
authored
Aug 07, 2013
by
Kevin Chugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update tests to manufacture threads and subscriptions
parent
823f1acb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletions
+18
-1
spec/api/notifications_spec.rb
+18
-1
No files found.
spec/api/notifications_spec.rb
View file @
1f59831e
...
@@ -28,9 +28,26 @@ describe "app" do
...
@@ -28,9 +28,26 @@ describe "app" do
end
end
it
"returns only threads subscribed to by user"
do
it
"returns only threads subscribed to by user"
do
# first make a dummy thread and comment and a subscription
commentable
=
Commentable
.
new
(
"question_1"
)
user
=
User
.
first
random_string
=
(
0
...
8
).
map
{
(
'a'
..
'z'
).
to_a
[
rand
(
26
)]
}.
join
thread
=
CommentThread
.
new
(
title:
"Test title"
,
body:
"elephant otter"
,
course_id:
"1"
,
commentable_id:
commentable
.
id
,
comments_text_dummy:
random_string
)
thread
.
author
=
user
thread
.
save!
subscription
=
Subscription
.
create
({
:subscriber_id
=>
user
.
_id
.
to_s
,
:source_id
=>
thread
.
_id
.
to_s
})
comment
=
Comment
.
new
(
body:
random_string
,
course_id:
"1"
,
commentable_id:
commentable
.
id
)
comment
.
author
=
user
comment
.
comment_thread
=
thread
comment
.
save!
start_time
=
Date
.
today
-
400
.
days
start_time
=
Date
.
today
-
400
.
days
end_time
=
Time
.
now
end_time
=
Time
.
now
user
=
User
.
find
Subscription
.
first
.
subscriber_id
post
"/api/v1/notifications"
,
from:
CGI
::
escape
(
start_time
.
to_s
),
to:
CGI
::
escape
(
end_time
.
to_s
),
user_ids:
user
.
id
post
"/api/v1/notifications"
,
from:
CGI
::
escape
(
start_time
.
to_s
),
to:
CGI
::
escape
(
end_time
.
to_s
),
user_ids:
user
.
id
last_response
.
should
be_ok
last_response
.
should
be_ok
payload
=
JSON
.
parse
last_response
.
body
payload
=
JSON
.
parse
last_response
.
body
...
...
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