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
f37b4cc5
Commit
f37b4cc5
authored
Sep 15, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Different created_at and updated_at time in api merge_requests spec.
parent
b99b2e60
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
31 deletions
+55
-31
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+55
-31
No files found.
spec/requests/api/merge_requests_spec.rb
View file @
f37b4cc5
...
...
@@ -57,37 +57,45 @@ describe API::API, api: true do
json_response
.
length
.
should
==
1
json_response
.
first
[
'title'
].
should
==
merge_request_merged
.
title
end
context
"with ordering"
do
before
do
@mr_later
=
mr_with_later_created_and_updated_at_time
@mr_earlier
=
mr_with_earlier_created_and_updated_at_time
end
it
"should return an array of merge_requests in ascending order"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests?sort=asc"
,
user
)
response
.
status
.
should
==
200
json_response
.
should
be_an
Array
json_response
.
length
.
should
==
3
json_response
.
first
[
'id'
].
should
==
merge_request
.
id
json_response
.
last
[
'id'
].
should
==
merge_request_merged
.
id
json_response
.
first
[
'id'
].
should
==
@mr_earlier
.
id
json_response
.
last
[
'id'
].
should
==
@mr_later
.
id
end
it
"should return an array of merge_requests in descending order"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests?sort=desc"
,
user
)
response
.
status
.
should
==
200
json_response
.
should
be_an
Array
json_response
.
length
.
should
==
3
json_response
.
first
[
'id'
].
should
==
merge_request_merged
.
id
json_response
.
last
[
'id'
].
should
==
merge_request
.
id
json_response
.
first
[
'id'
].
should
==
@mr_later
.
id
json_response
.
last
[
'id'
].
should
==
@mr_earlier
.
id
end
it
"should return an array of merge_requests ordered by updated_at"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests?order_by=updated_at"
,
user
)
response
.
status
.
should
==
200
json_response
.
should
be_an
Array
json_response
.
length
.
should
==
3
json_response
.
first
[
'id'
].
should
==
merge_request
.
id
json_response
.
last
[
'id'
].
should
==
merge_request_merged
.
id
json_response
.
first
[
'id'
].
should
==
@mr_earlier
.
id
json_response
.
last
[
'id'
].
should
==
@mr_later
.
id
end
it
"should return an array of merge_requests ordered by created_at"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests?sort=created_at"
,
user
)
response
.
status
.
should
==
200
json_response
.
should
be_an
Array
json_response
.
length
.
should
==
3
json_response
.
first
[
'id'
].
should
==
merge_request
.
id
json_response
.
last
[
'id'
].
should
==
merge_request_merged
.
id
json_response
.
first
[
'id'
].
should
==
@mr_earlier
.
id
json_response
.
last
[
'id'
].
should
==
@mr_later
.
id
end
end
end
end
...
...
@@ -328,4 +336,20 @@ describe API::API, api: true do
response
.
status
.
should
==
404
end
end
def
mr_with_later_created_and_updated_at_time
merge_request
merge_request
.
created_at
+=
1
.
hour
merge_request
.
updated_at
+=
30
.
minutes
merge_request
.
save
merge_request
end
def
mr_with_earlier_created_and_updated_at_time
merge_request_closed
merge_request_closed
.
created_at
-=
1
.
hour
merge_request_closed
.
updated_at
-=
30
.
minutes
merge_request_closed
.
save
merge_request_closed
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