Commit 8707827d authored by Grzegorz Bizon's avatar Grzegorz Bizon

Improve readablity of CI_API_V4_URL related code

parent 476cba6f
......@@ -1705,9 +1705,7 @@ class Project < ActiveRecord::Base
def api_variables
Gitlab::Ci::Variables::Collection.new.tap do |variables|
API::Helpers::Version.new('v4').tap do |version|
variables.append(key: 'CI_API_V4_URL', value: version.root_url)
end
variables.append(key: 'CI_API_V4_URL', value: API::Helpers::Version.new('v4').root_url)
end
end
......
......@@ -20,7 +20,7 @@ describe API::Helpers::Version do
describe '#root_url' do
it 'returns an URL for a root path for the API version' do
expect(described_class.new('v4').root_url)
.to match %r{^http?://.*/api/v4$}
.to eq 'http://localhost/api/v4'
end
end
end
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