Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gab-social
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
gab
social
gab-social
Commits
0874251b
Verified
Commit
0874251b
authored
Nov 18, 2019
by
Alex Gleason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update StatusesController tests
parent
82d47622
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
64 deletions
+2
-64
spec/controllers/statuses_controller_spec.rb
spec/controllers/statuses_controller_spec.rb
+2
-64
No files found.
spec/controllers/statuses_controller_spec.rb
View file @
0874251b
...
...
@@ -67,78 +67,16 @@ describe StatusesController do
expect
(
assigns
(
:type
)).
to
eq
'status'
end
it
'assigns @ancestors for ancestors of the status if it is a reply'
do
ancestor
=
Fabricate
(
:status
)
status
=
Fabricate
(
:status
,
in_reply_to_id:
ancestor
.
id
)
get
:show
,
params:
{
account_username:
status
.
account
.
username
,
id:
status
.
id
}
expect
(
assigns
(
:ancestors
)).
to
eq
[
ancestor
]
end
it
'assigns @ancestors for [] if it is not a reply'
do
status
=
Fabricate
(
:status
)
get
:show
,
params:
{
account_username:
status
.
account
.
username
,
id:
status
.
id
}
expect
(
assigns
(
:ancestors
)).
to
eq
[]
end
it
'assigns @descendant_threads for a thread with several statuses'
do
status
=
Fabricate
(
:status
)
child
=
Fabricate
(
:status
,
in_reply_to_id:
status
.
id
)
grandchild
=
Fabricate
(
:status
,
in_reply_to_id:
child
.
id
)
get
:show
,
params:
{
account_username:
status
.
account
.
username
,
id:
status
.
id
}
expect
(
assigns
(
:descendant_threads
)[
0
][
:statuses
].
pluck
(
:id
)).
to
eq
[
child
.
id
,
grandchild
.
id
]
end
it
'assigns @descendant_threads for several threads sharing the same descendant'
do
status
=
Fabricate
(
:status
)
child
=
Fabricate
(
:status
,
in_reply_to_id:
status
.
id
)
grandchildren
=
2
.
times
.
map
{
Fabricate
(
:status
,
in_reply_to_id:
child
.
id
)
}
get
:show
,
params:
{
account_username:
status
.
account
.
username
,
id:
status
.
id
}
expect
(
assigns
(
:descendant_threads
)[
0
][
:statuses
].
pluck
(
:id
)).
to
eq
[
child
.
id
,
grandchildren
[
0
].
id
]
expect
(
assigns
(
:descendant_threads
)[
1
][
:statuses
].
pluck
(
:id
)).
to
eq
[
grandchildren
[
1
].
id
]
end
it
'assigns @max_descendant_thread_id for the last thread if it is hitting the status limit'
do
stub_const
'StatusesController::DESCENDANTS_LIMIT'
,
1
status
=
Fabricate
(
:status
)
child
=
Fabricate
(
:status
,
in_reply_to_id:
status
.
id
)
get
:show
,
params:
{
account_username:
status
.
account
.
username
,
id:
status
.
id
}
expect
(
assigns
(
:descendant_threads
)).
to
eq
[]
expect
(
assigns
(
:max_descendant_thread_id
)).
to
eq
child
.
id
end
it
'assigns @descendant_threads for threads with :next_status key if they are hitting the depth limit'
do
stub_const
'StatusesController::DESCENDANTS_DEPTH_LIMIT'
,
2
status
=
Fabricate
(
:status
)
child0
=
Fabricate
(
:status
,
in_reply_to_id:
status
.
id
)
child1
=
Fabricate
(
:status
,
in_reply_to_id:
child0
.
id
)
child2
=
Fabricate
(
:status
,
in_reply_to_id:
child0
.
id
)
get
:show
,
params:
{
account_username:
status
.
account
.
username
,
id:
status
.
id
}
expect
(
assigns
(
:descendant_threads
)[
0
][
:statuses
].
pluck
(
:id
)).
not_to
include
child1
.
id
expect
(
assigns
(
:descendant_threads
)[
1
][
:statuses
].
pluck
(
:id
)).
not_to
include
child2
.
id
expect
(
assigns
(
:descendant_threads
)[
0
][
:next_status
].
id
).
to
eq
child1
.
id
expect
(
assigns
(
:descendant_threads
)[
1
][
:next_status
].
id
).
to
eq
child2
.
id
end
it
'returns a success'
do
status
=
Fabricate
(
:status
)
get
:show
,
params:
{
account_username:
status
.
account
.
username
,
id:
status
.
id
}
expect
(
response
).
to
have_http_status
(
200
)
end
it
'renders
stream_entries/show
'
do
it
'renders
the React front-end
'
do
status
=
Fabricate
(
:status
)
get
:show
,
params:
{
account_username:
status
.
account
.
username
,
id:
status
.
id
}
expect
(
response
).
to
render_template
'
stream_entries/show
'
expect
(
response
).
to
render_template
'
react/react
'
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