Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2019-01-04 20:29:01 +0300
committerDouwe Maan <douwe@gitlab.com>2019-01-04 20:29:01 +0300
commit303f049358645312c6f77d08750e489475494201 (patch)
tree1a0a80849d9c711dac76b0344b37d17146029be5 /spec/lib
parentd85e04e45247a64c704a44a2c8abecba94972061 (diff)
parent8707827d3925441a838ba425e65dfdb8d3845a31 (diff)
Merge branch 'feature/gb/expose-ci-api-url-variable' into 'master'
Expose `CI_API_V4_URL` CI/CD variable Closes #54621 See merge request gitlab-org/gitlab-ce!23936
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/api/api_spec.rb21
-rw-r--r--spec/lib/api/helpers/version_spec.rb26
2 files changed, 47 insertions, 0 deletions
diff --git a/spec/lib/api/api_spec.rb b/spec/lib/api/api_spec.rb
new file mode 100644
index 00000000000..ceef0b41e59
--- /dev/null
+++ b/spec/lib/api/api_spec.rb
@@ -0,0 +1,21 @@
+require 'spec_helper'
+
+describe API::API do
+ describe '.prefix' do
+ it 'has a prefix defined' do
+ expect(described_class.prefix).to eq :api
+ end
+ end
+
+ describe '.version' do
+ it 'uses most recent version of the API' do
+ expect(described_class.version).to eq 'v4'
+ end
+ end
+
+ describe '.versions' do
+ it 'returns all available versions' do
+ expect(described_class.versions).to eq %w[v3 v4]
+ end
+ end
+end
diff --git a/spec/lib/api/helpers/version_spec.rb b/spec/lib/api/helpers/version_spec.rb
new file mode 100644
index 00000000000..34006e0930b
--- /dev/null
+++ b/spec/lib/api/helpers/version_spec.rb
@@ -0,0 +1,26 @@
+require 'spec_helper'
+
+describe API::Helpers::Version do
+ describe '.new' do
+ it 'is possible to initialize it with existing API version' do
+ expect(described_class.new('v4').to_s).to eq 'v4'
+ end
+
+ it 'raises an error when unsupported API version is provided' do
+ expect { described_class.new('v111') }.to raise_error ArgumentError
+ end
+ end
+
+ describe '#root_path' do
+ it 'returns a root path of the API version' do
+ expect(described_class.new('v4').root_path).to eq '/api/v4'
+ end
+ end
+
+ 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 eq 'http://localhost/api/v4'
+ end
+ end
+end