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
e839ef1f
Commit
e839ef1f
authored
Aug 07, 2013
by
Kevin Chugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update tests to manufacture fixtures instead of relying on existing data
parent
c2265050
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
spec/api/notifications_spec.rb
+10
-4
No files found.
spec/api/notifications_spec.rb
View file @
e839ef1f
...
...
@@ -6,8 +6,13 @@ describe "app" do
describe
"POST /api/v1/notifications"
do
it
"returns notifications by class and user"
do
start_time
=
Time
.
now
user
=
User
.
first
thread
=
CommentThread
.
first
user
=
User
.
create
(
:email
=>
"test@example.com"
,
:external_id
=>
1
,
:username
=>
"example"
)
commentable
=
Commentable
.
new
(
"question_1"
)
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
})
dummy
=
random_string
=
(
0
..
5
).
map
{
(
'a'
..
'z'
).
to_a
[
rand
(
26
)]
}.
join
...
...
@@ -31,7 +36,7 @@ describe "app" do
# first make a dummy thread and comment and a subscription
commentable
=
Commentable
.
new
(
"question_1"
)
user
=
User
.
first
user
=
User
.
create
(
:email
=>
"test@example.com"
,
:external_id
=>
1
,
:username
=>
"example"
)
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
)
...
...
@@ -71,7 +76,8 @@ describe "app" do
it
"returns only unflagged threads"
do
start_time
=
Date
.
today
-
400
.
days
end_time
=
Time
.
now
user
=
User
.
find
Subscription
.
first
.
subscriber_id
user
=
User
.
create
(
:email
=>
"test@example.com"
,
:external_id
=>
1
,
:username
=>
"example"
)
sleep
1
...
...
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