Files
gitlab-foss/spec/lib/gitlab/url_helpers_spec.rb
2024-10-07 15:13:46 +00:00

22 lines
640 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::UrlHelpers, feature_category: :shared do
using RSpec::Parameterized::TableSyntax
describe '.normalized_base_url' do
where(:url, :value) do
'http://' | nil
'ssh://foo:bar@example.com' | 'ssh://example.com'
'http://foo:bar@example.com:3000/dir' | 'http://example.com:3000'
'http://foo:bar@example.com/dir' | 'http://example.com'
'https://foo:bar@subdomain.example.com/dir' | 'https://subdomain.example.com'
end
with_them do
it { expect(described_class.normalized_base_url(url)).to eq(value) }
end
end
end