Commit aea08697 authored by Robert Speicher's avatar Robert Speicher

Expose web_url to Compare API endpoint

Changelog: added
parent 9841861b
......@@ -200,7 +200,8 @@ Example response:
"deleted_file": false
}],
"compare_timeout": false,
"compare_same_ref": false
"compare_same_ref": false,
"web_url": "https://gitlab.example.com/thedude/gitlab-foss/-/compare/ae73cb07c9eeaf35924a10f713b364d32b2dd34f...0b4bc9a49b562e85de7cc9e834518ea6828729b9"
}
```
......
......@@ -20,6 +20,10 @@ module API
end
expose :same, as: :compare_same_ref
expose :web_url do |compare, _|
Gitlab::UrlBuilder.build(compare)
end
end
end
end
......@@ -354,6 +354,7 @@ RSpec.describe API::Repositories do
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['commits']).to be_present
expect(json_response['diffs']).to be_present
expect(json_response['web_url']).to be_present
end
it "compares branches with explicit merge-base mode" do
......@@ -365,6 +366,7 @@ RSpec.describe API::Repositories do
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['commits']).to be_present
expect(json_response['diffs']).to be_present
expect(json_response['web_url']).to be_present
end
it "compares branches with explicit straight mode" do
......@@ -376,6 +378,7 @@ RSpec.describe API::Repositories do
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['commits']).to be_present
expect(json_response['diffs']).to be_present
expect(json_response['web_url']).to be_present
end
it "compares tags" do
......@@ -384,6 +387,7 @@ RSpec.describe API::Repositories do
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['commits']).to be_present
expect(json_response['diffs']).to be_present
expect(json_response['web_url']).to be_present
end
it "compares commits" do
......@@ -393,6 +397,7 @@ RSpec.describe API::Repositories do
expect(json_response['commits']).to be_empty
expect(json_response['diffs']).to be_empty
expect(json_response['compare_same_ref']).to be_falsey
expect(json_response['web_url']).to be_present
end
it "compares commits in reverse order" do
......@@ -401,6 +406,7 @@ RSpec.describe API::Repositories do
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['commits']).to be_present
expect(json_response['diffs']).to be_present
expect(json_response['web_url']).to be_present
end
it "compare commits between different projects with non-forked relation" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment