summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/api_helpers.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/support/api_helpers.rb b/spec/support/api_helpers.rb
index f63322776d4..1b3cafb497c 100644
--- a/spec/support/api_helpers.rb
+++ b/spec/support/api_helpers.rb
@@ -28,6 +28,17 @@ module ApiHelpers
"&private_token=#{user.private_token}" : "")
end
+ def ci_api(path, user = nil)
+ "/ci/api/v1/#{path}" +
+
+ # Normalize query string
+ (path.index('?') ? '' : '?') +
+
+ # Append private_token if given a User object
+ (user.respond_to?(:private_token) ?
+ "&private_token=#{user.private_token}" : "")
+ end
+
def json_response
@_json_response ||= JSON.parse(response.body)
end