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
f7cd7f3d
Commit
f7cd7f3d
authored
Jan 04, 2016
by
Clinton Blackburn
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #168 from edx/clintonb/remove-dead-code
Updated spec_helper
parents
abc1c11b
042f9caa
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
45 deletions
+4
-45
spec/spec_helper.rb
+4
-45
No files found.
spec/spec_helper.rb
View file @
f7cd7f3d
...
@@ -40,7 +40,6 @@ def set_api_key_header
...
@@ -40,7 +40,6 @@ def set_api_key_header
end
end
RSpec
.
configure
do
|
config
|
RSpec
.
configure
do
|
config
|
config
.
include
Rack
::
Test
::
Methods
config
.
include
Rack
::
Test
::
Methods
config
.
treat_symbols_as_metadata_keys_with_true_values
=
true
config
.
treat_symbols_as_metadata_keys_with_true_values
=
true
...
@@ -63,7 +62,7 @@ end
...
@@ -63,7 +62,7 @@ end
def
init_without_subscriptions
def
init_without_subscriptions
commentable
=
Commentable
.
new
(
"question_1"
)
commentable
=
Commentable
.
new
(
"question_1"
)
users
=
(
1
..
10
).
map
{
|
id
|
create_test_user
(
id
)
}
users
=
(
1
..
10
).
map
{
|
id
|
create_test_user
(
id
)
}
user
=
users
.
first
user
=
users
.
first
thread
=
CommentThread
.
new
(
title:
"I can't solve this problem"
,
body:
"can anyone help me?"
,
course_id:
"1"
,
commentable_id:
commentable
.
id
)
thread
=
CommentThread
.
new
(
title:
"I can't solve this problem"
,
body:
"can anyone help me?"
,
course_id:
"1"
,
commentable_id:
commentable
.
id
)
...
@@ -132,12 +131,12 @@ def init_without_subscriptions
...
@@ -132,12 +131,12 @@ def init_without_subscriptions
Comment
.
all
.
each
do
|
c
|
Comment
.
all
.
each
do
|
c
|
user
.
vote
(
c
,
:up
)
# make the first user always vote up for convenience
user
.
vote
(
c
,
:up
)
# make the first user always vote up for convenience
users
[
2
,
9
].
each
{
|
user
|
user
.
vote
(
c
,
[
:up
,
:down
].
sample
)
}
users
[
2
,
9
].
each
{
|
user
|
user
.
vote
(
c
,
[
:up
,
:down
].
sample
)
}
end
end
CommentThread
.
all
.
each
do
|
c
|
CommentThread
.
all
.
each
do
|
c
|
user
.
vote
(
c
,
:up
)
# make the first user always vote up for convenience
user
.
vote
(
c
,
:up
)
# make the first user always vote up for convenience
users
[
2
,
9
].
each
{
|
user
|
user
.
vote
(
c
,
[
:up
,
:down
].
sample
)
}
users
[
2
,
9
].
each
{
|
user
|
user
.
vote
(
c
,
[
:up
,
:down
].
sample
)
}
end
end
Content
.
mongo_client
[
:blocked_hash
].
insert_one
(
hash:
Digest
::
MD5
.
hexdigest
(
"blocked post"
))
Content
.
mongo_client
[
:blocked_hash
].
insert_one
(
hash:
Digest
::
MD5
.
hexdigest
(
"blocked post"
))
...
@@ -147,46 +146,6 @@ def init_without_subscriptions
...
@@ -147,46 +146,6 @@ def init_without_subscriptions
end
end
end
end
def
init_with_subscriptions
user1
=
create_test_user
(
1
)
user2
=
create_test_user
(
2
)
user2
.
subscribe
(
user1
)
commentable
=
Commentable
.
new
(
"question_1"
)
user1
.
subscribe
(
commentable
)
user2
.
subscribe
(
commentable
)
thread
=
CommentThread
.
new
(
title:
"I can't solve this problem"
,
body:
"can anyone help me?"
,
course_id:
"1"
,
commentable_id:
commentable
.
id
)
thread
.
author
=
user1
user1
.
subscribe
(
thread
)
user2
.
subscribe
(
thread
)
thread
.
save!
thread
=
thread
.
reload
comment
=
thread
.
comments
.
new
(
body:
"this problem is so easy"
,
course_id:
"1"
)
comment
.
author
=
user2
comment
.
save!
comment1
=
comment
.
children
.
new
(
body:
"not for me!"
,
course_id:
"1"
)
comment1
.
author
=
user1
comment1
.
comment_thread
=
thread
comment1
.
save!
comment2
=
comment1
.
children
.
new
(
body:
"not for me neither!"
,
course_id:
"1"
)
comment2
.
author
=
user2
comment2
.
comment_thread
=
thread
comment2
.
save!
thread
=
CommentThread
.
new
(
title:
"This problem is wrong"
,
body:
"it is unsolvable"
,
course_id:
"2"
,
commentable_id:
commentable
.
id
)
thread
.
author
=
user2
user2
.
subscribe
(
thread
)
thread
.
save!
thread
=
CommentThread
.
new
(
title:
"I don't know what to say"
,
body:
"lol"
,
course_id:
"2"
,
commentable_id:
"something else"
)
thread
.
author
=
user1
thread
.
save!
end
# this method is used to test results produced using the helper function handle_threads_query
# this method is used to test results produced using the helper function handle_threads_query
# which is used in multiple areas of the API
# which is used in multiple areas of the API
def
check_thread_result
(
user
,
thread
,
hash
,
is_json
=
false
)
def
check_thread_result
(
user
,
thread
,
hash
,
is_json
=
false
)
...
@@ -409,5 +368,5 @@ def setup_10_threads
...
@@ -409,5 +368,5 @@ def setup_10_threads
@comments
[
"t
#{
i
}
c
#{
j
}
"
]
=
comment
@comments
[
"t
#{
i
}
c
#{
j
}
"
]
=
comment
end
end
end
end
@default_order
=
10
.
times
.
map
{
|
i
|
"t
#{
i
}
"
}.
reverse
@default_order
=
10
.
times
.
map
{
|
i
|
"t
#{
i
}
"
}.
reverse
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