Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mastofe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Pleroma
mastofe
Commits
ad881423
Commit
ad881423
authored
6 years ago
by
Shuhei Kitagawa
Committed by
Yamagishi Kazutoshi
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for following accounts controller (#7800)
parent
0338da16
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
spec/controllers/following_accounts_controller_spec.rb
+36
-9
36 additions, 9 deletions
spec/controllers/following_accounts_controller_spec.rb
with
36 additions
and
9 deletions
spec/controllers/following_accounts_controller_spec.rb
+
36
−
9
View file @
ad881423
...
...
@@ -8,18 +8,45 @@ describe FollowingAccountsController do
let
(
:followee1
)
{
Fabricate
(
:account
)
}
describe
'GET #index'
do
it
'assigns followees'
do
follow0
=
alice
.
follow!
(
followee0
)
follow1
=
alice
.
follow!
(
followee1
)
let!
(
:follow0
)
{
alice
.
follow!
(
followee0
)
}
let!
(
:follow1
)
{
alice
.
follow!
(
followee1
)
}
get
:index
,
params:
{
account_username:
alice
.
username
}
context
'when format is html'
do
subject
(
:response
)
{
get
:index
,
params:
{
account_username:
alice
.
username
,
format: :html
}
}
assigned
=
assigns
(
:follows
).
to_a
expect
(
assigned
.
size
).
to
eq
2
expect
(
assigned
[
0
]).
to
eq
follow1
expect
(
assigned
[
1
]).
to
eq
follow0
it
'assigns follows'
do
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
assigned
=
assigns
(
:follows
).
to_a
expect
(
assigned
.
size
).
to
eq
2
expect
(
assigned
[
0
]).
to
eq
follow1
expect
(
assigned
[
1
]).
to
eq
follow0
end
end
context
'when format is json'
do
subject
(
:response
)
{
get
:index
,
params:
{
account_username:
alice
.
username
,
page:
page
,
format: :json
}
}
subject
(
:body
)
{
JSON
.
parse
(
response
.
body
)
}
context
'with page'
do
let
(
:page
)
{
1
}
it
'returns followers'
do
expect
(
response
).
to
have_http_status
(
200
)
expect
(
body
[
'totalItems'
]).
to
eq
2
expect
(
body
[
'partOf'
]).
to
be_present
end
end
context
'without page'
do
let
(
:page
)
{
nil
}
it
'returns followers'
do
expect
(
response
).
to
have_http_status
(
200
)
expect
(
body
[
'totalItems'
]).
to
eq
2
expect
(
body
[
'partOf'
]).
to
be_blank
end
end
end
end
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