Commit dd4bd1d7 authored by Ash McKenzie's avatar Ash McKenzie

Add #base_api_endpoint for re-usability

parent 3042a721
...@@ -7,8 +7,12 @@ module HTTPHelper ...@@ -7,8 +7,12 @@ module HTTPHelper
@config ||= GitlabConfig.new @config ||= GitlabConfig.new
end end
def base_api_endpoint
"#{config.gitlab_url}/api/v4"
end
def host def host
"#{config.gitlab_url}/api/v4/internal" "#{base_api_endpoint}/internal"
end end
def http_client_for(uri, options = {}) def http_client_for(uri, options = {})
......
...@@ -353,6 +353,14 @@ describe GitlabNet, vcr: true do ...@@ -353,6 +353,14 @@ describe GitlabNet, vcr: true do
end end
end end
describe :base_api_endpoint do
let(:net) { GitlabNet.new }
subject { net.send :base_api_endpoint }
it { should include(net.send(:config).gitlab_url) }
it("uses API version 4") { should end_with("api/v4") }
end
describe :host do describe :host do
let(:net) { GitlabNet.new } let(:net) { GitlabNet.new }
subject { net.send :host } subject { net.send :host }
......
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