Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mastodon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pierre Boudes
mastodon
Commits
63d15d53
Unverified
Commit
63d15d53
authored
1 year ago
by
Matt Jankowski
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Speed-up on `StatusesController` spec (#25549)
parent
8d2c2683
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
spec/controllers/statuses_controller_spec.rb
+19
-214
19 additions, 214 deletions
spec/controllers/statuses_controller_spec.rb
with
19 additions
and
214 deletions
spec/controllers/statuses_controller_spec.rb
+
19
−
214
View file @
63d15d53
...
...
@@ -75,23 +75,11 @@ describe StatusesController do
context
'with HTML'
do
let
(
:format
)
{
'html'
}
it
're
turns http success'
do
it
're
nders status successfully'
,
:aggregate_failures
do
expect
(
response
).
to
have_http_status
(
200
)
end
it
'returns Link header'
do
expect
(
response
.
headers
[
'Link'
].
to_s
).
to
include
'activity+json'
end
it
'returns Vary header'
do
expect
(
response
.
headers
[
'Vary'
]).
to
eq
'Accept, Accept-Language, Cookie'
end
it
'returns public Cache-Control header'
do
expect
(
response
.
headers
[
'Cache-Control'
]).
to
include
'public'
end
it
'renders status'
do
expect
(
response
).
to
render_template
(
:show
)
expect
(
response
.
body
).
to
include
status
.
text
end
...
...
@@ -100,25 +88,13 @@ describe StatusesController do
context
'with JSON'
do
let
(
:format
)
{
'json'
}
it
'returns http success'
do
expect
(
response
).
to
have_http_status
(
200
)
end
it_behaves_like
'cacheable response'
it
'returns Link header'
do
it
'renders ActivityPub Note object successfully'
,
:aggregate_failures
do
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
.
headers
[
'Link'
].
to_s
).
to
include
'activity+json'
end
it
'returns Vary header'
do
expect
(
response
.
headers
[
'Vary'
]).
to
eq
'Accept, Accept-Language, Cookie'
end
it_behaves_like
'cacheable response'
it
'returns Content-Type header'
do
expect
(
response
.
headers
[
'Content-Type'
]).
to
include
'application/activity+json'
end
it
'renders ActivityPub Note object'
do
json
=
body_as_json
expect
(
json
[
:content
]).
to
include
status
.
text
end
...
...
@@ -199,23 +175,11 @@ describe StatusesController do
context
'with HTML'
do
let
(
:format
)
{
'html'
}
it
're
turns http success'
do
it
're
nders status successfully'
,
:aggregate_failures
do
expect
(
response
).
to
have_http_status
(
200
)
end
it
'returns Link header'
do
expect
(
response
.
headers
[
'Link'
].
to_s
).
to
include
'activity+json'
end
it
'returns Vary header'
do
expect
(
response
.
headers
[
'Vary'
]).
to
eq
'Accept, Accept-Language, Cookie'
end
it
'returns private Cache-Control header'
do
expect
(
response
.
headers
[
'Cache-Control'
]).
to
include
'private'
end
it
'renders status'
do
expect
(
response
).
to
render_template
(
:show
)
expect
(
response
.
body
).
to
include
status
.
text
end
...
...
@@ -224,27 +188,12 @@ describe StatusesController do
context
'with JSON'
do
let
(
:format
)
{
'json'
}
it
're
turns http success'
do
it
're
nders ActivityPub Note object successfully'
,
:aggregate_failures
do
expect
(
response
).
to
have_http_status
(
200
)
end
it
'returns Link header'
do
expect
(
response
.
headers
[
'Link'
].
to_s
).
to
include
'activity+json'
end
it
'returns Vary header'
do
expect
(
response
.
headers
[
'Vary'
]).
to
eq
'Accept, Accept-Language, Cookie'
end
it
'returns private Cache-Control header'
do
expect
(
response
.
headers
[
'Cache-Control'
]).
to
include
'private'
end
it
'returns Content-Type header'
do
expect
(
response
.
headers
[
'Content-Type'
]).
to
include
'application/activity+json'
end
it
'renders ActivityPub Note object'
do
json
=
body_as_json
expect
(
json
[
:content
]).
to
include
status
.
text
end
...
...
@@ -263,23 +212,11 @@ describe StatusesController do
context
'with HTML'
do
let
(
:format
)
{
'html'
}
it
're
turns http success'
do
it
're
nders status successfully'
,
:aggregate_failures
do
expect
(
response
).
to
have_http_status
(
200
)
end
it
'returns Link header'
do
expect
(
response
.
headers
[
'Link'
].
to_s
).
to
include
'activity+json'
end
it
'returns Vary header'
do
expect
(
response
.
headers
[
'Vary'
]).
to
eq
'Accept, Accept-Language, Cookie'
end
it
'returns private Cache-Control header'
do
expect
(
response
.
headers
[
'Cache-Control'
]).
to
include
'private'
end
it
'renders status'
do
expect
(
response
).
to
render_template
(
:show
)
expect
(
response
.
body
).
to
include
status
.
text
end
...
...
@@ -288,27 +225,12 @@ describe StatusesController do
context
'with JSON'
do
let
(
:format
)
{
'json'
}
it
're
turns http success'
do
it
're
nders ActivityPub Note object successfully'
,
:aggregate_failures
do
expect
(
response
).
to
have_http_status
(
200
)
end
it
'returns Link header'
do
expect
(
response
.
headers
[
'Link'
].
to_s
).
to
include
'activity+json'
end
it
'returns Vary header'
do
expect
(
response
.
headers
[
'Vary'
]).
to
eq
'Accept, Accept-Language, Cookie'
end
it
'returns private Cache-Control header'
do
expect
(
response
.
headers
[
'Cache-Control'
]).
to
include
'private'
end
it
'returns Content-Type header'
do
expect
(
response
.
headers
[
'Content-Type'
]).
to
include
'application/activity+json'
end
it
'renders ActivityPub Note object'
do
json
=
body_as_json
expect
(
json
[
:content
]).
to
include
status
.
text
end
...
...
@@ -350,23 +272,11 @@ describe StatusesController do
context
'with HTML'
do
let
(
:format
)
{
'html'
}
it
're
turns http success'
do
it
're
nders status successfully'
,
:aggregate_failures
do
expect
(
response
).
to
have_http_status
(
200
)
end
it
'returns Link header'
do
expect
(
response
.
headers
[
'Link'
].
to_s
).
to
include
'activity+json'
end
it
'returns Vary header'
do
expect
(
response
.
headers
[
'Vary'
]).
to
eq
'Accept, Accept-Language, Cookie'
end
it
'returns private Cache-Control header'
do
expect
(
response
.
headers
[
'Cache-Control'
]).
to
include
'private'
end
it
'renders status'
do
expect
(
response
).
to
render_template
(
:show
)
expect
(
response
.
body
).
to
include
status
.
text
end
...
...
@@ -375,27 +285,12 @@ describe StatusesController do
context
'with JSON'
do
let
(
:format
)
{
'json'
}
it
're
turns http
success'
do
it
're
nders ActivityPub Note object
success
fully
'
do
expect
(
response
).
to
have_http_status
(
200
)
end
it
'returns Link header'
do
expect
(
response
.
headers
[
'Link'
].
to_s
).
to
include
'activity+json'
end
it
'returns Vary header'
do
expect
(
response
.
headers
[
'Vary'
]).
to
eq
'Accept, Accept-Language, Cookie'
end
it
'returns private Cache-Control header'
do
expect
(
response
.
headers
[
'Cache-Control'
]).
to
include
'private'
end
it
'returns Content-Type header'
do
expect
(
response
.
headers
[
'Content-Type'
]).
to
include
'application/activity+json'
end
it
'renders ActivityPub Note object'
do
json
=
body_as_json
expect
(
json
[
:content
]).
to
include
status
.
text
end
...
...
@@ -463,23 +358,11 @@ describe StatusesController do
context
'with HTML'
do
let
(
:format
)
{
'html'
}
it
're
turns http success'
do
it
're
nders status successfully'
,
:aggregate_failures
do
expect
(
response
).
to
have_http_status
(
200
)
end
it
'returns Link header'
do
expect
(
response
.
headers
[
'Link'
].
to_s
).
to
include
'activity+json'
end
it
'returns Vary header'
do
expect
(
response
.
headers
[
'Vary'
]).
to
eq
'Accept, Accept-Language, Cookie'
end
it
'returns private Cache-Control header'
do
expect
(
response
.
headers
[
'Cache-Control'
]).
to
include
'private'
end
it
'renders status'
do
expect
(
response
).
to
render_template
(
:show
)
expect
(
response
.
body
).
to
include
status
.
text
end
...
...
@@ -488,25 +371,13 @@ describe StatusesController do
context
'with JSON'
do
let
(
:format
)
{
'json'
}
it
'returns http success'
do
expect
(
response
).
to
have_http_status
(
200
)
end
it_behaves_like
'cacheable response'
it
'returns Link header'
do
it
'renders ActivityPub Note object successfully'
,
:aggregate_failures
do
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
.
headers
[
'Link'
].
to_s
).
to
include
'activity+json'
end
it
'returns Vary header'
do
expect
(
response
.
headers
[
'Vary'
]).
to
eq
'Accept, Accept-Language, Cookie'
end
it_behaves_like
'cacheable response'
it
'returns Content-Type header'
do
expect
(
response
.
headers
[
'Content-Type'
]).
to
include
'application/activity+json'
end
it
'renders ActivityPub Note object'
do
json
=
body_as_json
expect
(
json
[
:content
]).
to
include
status
.
text
end
...
...
@@ -525,23 +396,11 @@ describe StatusesController do
context
'with HTML'
do
let
(
:format
)
{
'html'
}
it
're
turns http success'
do
it
're
nders status successfully'
,
:aggregate_failures
do
expect
(
response
).
to
have_http_status
(
200
)
end
it
'returns Link header'
do
expect
(
response
.
headers
[
'Link'
].
to_s
).
to
include
'activity+json'
end
it
'returns Vary header'
do
expect
(
response
.
headers
[
'Vary'
]).
to
eq
'Accept, Accept-Language, Cookie'
end
it
'returns private Cache-Control header'
do
expect
(
response
.
headers
[
'Cache-Control'
]).
to
include
'private'
end
it
'renders status'
do
expect
(
response
).
to
render_template
(
:show
)
expect
(
response
.
body
).
to
include
status
.
text
end
...
...
@@ -550,27 +409,12 @@ describe StatusesController do
context
'with JSON'
do
let
(
:format
)
{
'json'
}
it
're
turns http
success'
do
it
're
nders ActivityPub Note object
success
fully
'
do
expect
(
response
).
to
have_http_status
(
200
)
end
it
'returns Link header'
do
expect
(
response
.
headers
[
'Link'
].
to_s
).
to
include
'activity+json'
end
it
'returns Vary header'
do
expect
(
response
.
headers
[
'Vary'
]).
to
eq
'Accept, Accept-Language, Cookie'
end
it
'returns private Cache-Control header'
do
expect
(
response
.
headers
[
'Cache-Control'
]).
to
include
'private'
end
it
'returns Content-Type header'
do
expect
(
response
.
headers
[
'Content-Type'
]).
to
include
'application/activity+json'
end
it
'renders ActivityPub Note object'
do
json
=
body_as_json
expect
(
json
[
:content
]).
to
include
status
.
text
end
...
...
@@ -612,23 +456,11 @@ describe StatusesController do
context
'with HTML'
do
let
(
:format
)
{
'html'
}
it
're
turns http success'
do
it
're
nders status successfully'
,
:aggregate_failures
do
expect
(
response
).
to
have_http_status
(
200
)
end
it
'returns Link header'
do
expect
(
response
.
headers
[
'Link'
].
to_s
).
to
include
'activity+json'
end
it
'returns Vary header'
do
expect
(
response
.
headers
[
'Vary'
]).
to
eq
'Accept, Accept-Language, Cookie'
end
it
'returns private Cache-Control header'
do
expect
(
response
.
headers
[
'Cache-Control'
]).
to
include
'private'
end
it
'renders status'
do
expect
(
response
).
to
render_template
(
:show
)
expect
(
response
.
body
).
to
include
status
.
text
end
...
...
@@ -637,27 +469,12 @@ describe StatusesController do
context
'with JSON'
do
let
(
:format
)
{
'json'
}
it
're
turns http success'
do
it
're
nders ActivityPub Note object'
,
:aggregate_failures
do
expect
(
response
).
to
have_http_status
(
200
)
end
it
'returns Link header'
do
expect
(
response
.
headers
[
'Link'
].
to_s
).
to
include
'activity+json'
end
it
'returns Vary header'
do
expect
(
response
.
headers
[
'Vary'
]).
to
eq
'Accept, Accept-Language, Cookie'
end
it
'returns private Cache-Control header'
do
expect
(
response
.
headers
[
'Cache-Control'
]).
to
include
'private'
end
it
'returns Content-Type header'
do
expect
(
response
.
headers
[
'Content-Type'
]).
to
include
'application/activity+json'
end
it
'renders ActivityPub Note object'
do
json
=
body_as_json
expect
(
json
[
:content
]).
to
include
status
.
text
end
...
...
@@ -933,23 +750,11 @@ describe StatusesController do
get
:embed
,
params:
{
account_username:
status
.
account
.
username
,
id:
status
.
id
}
end
it
're
turns http success'
do
it
're
nders status successfully'
,
:aggregate_failures
do
expect
(
response
).
to
have_http_status
(
200
)
end
it
'returns Link header'
do
expect
(
response
.
headers
[
'Link'
].
to_s
).
to
include
'activity+json'
end
it
'returns Vary header'
do
expect
(
response
.
headers
[
'Vary'
]).
to
eq
'Accept, Accept-Language, Cookie'
end
it
'returns public Cache-Control header'
do
expect
(
response
.
headers
[
'Cache-Control'
]).
to
include
'public'
end
it
'renders status'
do
expect
(
response
).
to
render_template
(
:embed
)
expect
(
response
.
body
).
to
include
status
.
text
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment