diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-12-19 18:16:36 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2019-01-03 16:18:05 +0300 |
commit | 128a5e410f4c51bbbcb1540435d3bea0b9a9c04d (patch) | |
tree | 4e640ff331f6af1814c39e3fcdc09cb398b690f4 /spec/lib/api | |
parent | 32fbc12cc532f15392a4c4fa08b6229b06fe5bf0 (diff) |
Expose method that returns GitLab API paths
Diffstat (limited to 'spec/lib/api')
-rw-r--r-- | spec/lib/api/api_spec.rb | 36 |
1 files changed, 36 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..31881551980 --- /dev/null +++ b/spec/lib/api/api_spec.rb @@ -0,0 +1,36 @@ +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 ['v3', 'v4'] + end + end + + describe '.root_path' do + it 'returns predefined API version path' do + expect(described_class.root_path).to eq '/api/v4' + end + + it 'returns a version provided as keyword argument' do + expect(described_class.root_path(version: 'v3')).to eq '/api/v3' + end + + it 'raises an error if version is not known' do + expect { described_class.root_path(version: 'v10') } + .to raise_error ArgumentError + end + end +end |