Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
15389851
Commit
15389851
authored
Jul 06, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add finder and users API spec
parent
9d3b8832
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
+35
-0
spec/finders/users_finder_spec.rb
spec/finders/users_finder_spec.rb
+6
-0
spec/requests/api/users_spec.rb
spec/requests/api/users_spec.rb
+29
-0
No files found.
spec/finders/users_finder_spec.rb
View file @
15389851
...
...
@@ -61,6 +61,12 @@ describe UsersFinder do
expect
(
users
).
to
contain_exactly
(
user
,
user1
,
user2
,
omniauth_user
)
end
end
it
'filters by created_at'
do
users
=
described_class
.
new
(
user
,
created_after:
2
.
days
.
ago
,
created_before:
Time
.
now
+
2
.
days
).
execute
expect
(
users
.
count
).
to
eq
(
4
)
end
end
context
'with an admin user'
do
...
...
spec/requests/api/users_spec.rb
View file @
15389851
...
...
@@ -163,6 +163,35 @@ describe API::Users do
expect
(
response
).
to
have_http_status
(
400
)
end
it
"returns an user created before a specific date"
do
user
=
create
(
:user
,
created_at:
Date
.
new
(
2000
,
1
,
1
))
get
api
(
"/users?created_before=2000-01-02T00:00:00.060Z"
,
admin
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
.
size
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'username'
]).
to
eq
(
user
.
username
)
end
it
"returns no users created before a specific date"
do
create
(
:user
,
created_at:
Date
.
new
(
2001
,
1
,
1
))
get
api
(
"/users?created_before=2000-01-02T00:00:00.060Z"
,
admin
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
.
size
).
to
eq
(
0
)
end
it
"returns users created before and after a specific date"
do
user
=
create
(
:user
,
created_at:
Date
.
new
(
2001
,
1
,
1
))
get
api
(
"/users?created_before=2001-01-02T00:00:00.060Z&created_after=1999-01-02T00:00:00.060"
,
admin
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
.
size
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'username'
]).
to
eq
(
user
.
username
)
end
end
context
"when authenticated and ldap is enabled"
do
...
...
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