summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2016-05-04 17:27:47 +0200
committerDouwe Maan <douwe@selenight.nl>2016-05-04 17:27:47 +0200
commit6a8359f3d3be01af6f5b124b61af7ee1c77c17d0 (patch)
tree9e972713fc223d7a466ea2b1601a093d719f0817 /spec/requests
parent72e4bd5fc40c3b61792bf5f8897ab881775c7146 (diff)
parentc4b9bd041321df25764ad1de90f89b1f0dda9f33 (diff)
downloadgitlab-ce-6a8359f3d3be01af6f5b124b61af7ee1c77c17d0.tar.gz
Merge branch 'pacoguzman/gitlab-ce-15001-since-and-until-operators-api-commits'
# Conflicts: # Gemfile.lock
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/commits_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/requests/api/commits_spec.rb b/spec/requests/api/commits_spec.rb
index e28998d51b5..cb82ca7802d 100644
--- a/spec/requests/api/commits_spec.rb
+++ b/spec/requests/api/commits_spec.rb
@@ -32,6 +32,41 @@ describe API::API, api: true do
expect(response.status).to eq(401)
end
end
+
+ context "since optional parameter" do
+ it "should return project commits since provided parameter" do
+ commits = project.repository.commits("master")
+ since = commits.second.created_at
+
+ get api("/projects/#{project.id}/repository/commits?since=#{since.utc.iso8601}", user)
+
+ expect(json_response.size).to eq 2
+ expect(json_response.first["id"]).to eq(commits.first.id)
+ expect(json_response.second["id"]).to eq(commits.second.id)
+ end
+ end
+
+ context "until optional parameter" do
+ it "should return project commits until provided parameter" do
+ commits = project.repository.commits("master")
+ before = commits.second.created_at
+
+ get api("/projects/#{project.id}/repository/commits?until=#{before.utc.iso8601}", user)
+
+ expect(json_response.size).to eq(commits.size - 1)
+ expect(json_response.first["id"]).to eq(commits.second.id)
+ expect(json_response.second["id"]).to eq(commits.third.id)
+ end
+ end
+
+ context "invalid xmlschema date parameters" do
+ it "should return an invalid parameter error message" do
+ get api("/projects/#{project.id}/repository/commits?since=invalid-date", user)
+
+ expect(response.status).to eq(400)
+ expect(json_response['message']).to include "\"since\" must be a timestamp in ISO 8601 format"
+ end
+ end
end
describe "GET /projects:id/repository/commits/:sha" do