diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /spec/lib/gitlab/zentao/client_spec.rb | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/lib/gitlab/zentao/client_spec.rb')
-rw-r--r-- | spec/lib/gitlab/zentao/client_spec.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/lib/gitlab/zentao/client_spec.rb b/spec/lib/gitlab/zentao/client_spec.rb index 86b310fe417..135f13e6265 100644 --- a/spec/lib/gitlab/zentao/client_spec.rb +++ b/spec/lib/gitlab/zentao/client_spec.rb @@ -130,4 +130,36 @@ RSpec.describe Gitlab::Zentao::Client do end end end + + describe '#url' do + context 'api url' do + shared_examples 'joins api_url correctly' do + it 'verify url' do + expect(integration.send(:url, "products/1").to_s) + .to eq("https://jihudemo.zentao.net/zentao/api.php/v1/products/1") + end + end + + context 'no ends slash' do + let(:zentao_integration) { create(:zentao_integration, api_url: 'https://jihudemo.zentao.net/zentao') } + + include_examples 'joins api_url correctly' + end + + context 'ends slash' do + let(:zentao_integration) { create(:zentao_integration, api_url: 'https://jihudemo.zentao.net/zentao/') } + + include_examples 'joins api_url correctly' + end + end + + context 'no api url' do + let(:zentao_integration) { create(:zentao_integration, url: 'https://jihudemo.zentao.net') } + + it 'joins url correctly' do + expect(integration.send(:url, "products/1").to_s) + .to eq("https://jihudemo.zentao.net/api.php/v1/products/1") + end + end + end end |