Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Mastodon
Commits
0a53ca44
Commit
0a53ca44
authored
7 years ago
by
Akihiko Odaki (@fn_aki@pawoo.net)
Committed by
Eugen Rochko
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Cover Admin::AccountsController more (#3327)
parent
f79c1016
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/admin/accounts_controller_spec.rb
+54
-1
54 additions, 1 deletion
spec/controllers/admin/accounts_controller_spec.rb
with
54 additions
and
1 deletion
spec/controllers/admin/accounts_controller_spec.rb
+
54
−
1
View file @
0a53ca44
...
...
@@ -3,11 +3,64 @@ require 'rails_helper'
RSpec
.
describe
Admin
::
AccountsController
,
type: :controller
do
render_views
let
(
:user
)
{
Fabricate
(
:user
,
admin:
true
)
}
before
do
sign_in
Fabricate
(
:user
,
admin:
true
)
,
scope: :user
sign_in
user
,
scope: :user
end
describe
'GET #index'
do
around
do
|
example
|
default_per_page
=
Account
.
default_per_page
Account
.
paginates_per
1
example
.
run
Account
.
paginates_per
default_per_page
end
it
'filters with parameters'
do
new
=
AccountFilter
.
method
(
:new
)
expect
(
AccountFilter
).
to
receive
(
:new
)
do
|
params
|
h
=
params
.
to_h
expect
(
h
[
:local
]).
to
eq
'1'
expect
(
h
[
:remote
]).
to
eq
'1'
expect
(
h
[
:by_domain
]).
to
eq
'domain'
expect
(
h
[
:silenced
]).
to
eq
'1'
expect
(
h
[
:recent
]).
to
eq
'1'
expect
(
h
[
:suspended
]).
to
eq
'1'
expect
(
h
[
:username
]).
to
eq
'username'
expect
(
h
[
:display_name
]).
to
eq
'display name'
expect
(
h
[
:email
]).
to
eq
'local-part@domain'
expect
(
h
[
:ip
]).
to
eq
'0.0.0.42'
new
.
call
({})
end
get
:index
,
params:
{
local:
'1'
,
remote:
'1'
,
by_domain:
'domain'
,
silenced:
'1'
,
recent:
'1'
,
suspended:
'1'
,
username:
'username'
,
display_name:
'display name'
,
email:
'local-part@domain'
,
ip:
'0.0.0.42'
}
end
it
'paginates accounts'
do
Fabricate
(
:account
)
get
:index
,
params:
{
page:
2
}
accounts
=
assigns
(
:accounts
)
expect
(
accounts
.
count
).
to
eq
1
expect
(
accounts
.
klass
).
to
be
Account
end
it
'returns http success'
do
get
:index
expect
(
response
).
to
have_http_status
(
:success
)
...
...
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