diff options
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/submodule_helper_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/helpers/submodule_helper_spec.rb b/spec/helpers/submodule_helper_spec.rb index 7db45c05cb5..db0836c8550 100644 --- a/spec/helpers/submodule_helper_spec.rb +++ b/spec/helpers/submodule_helper_spec.rb @@ -81,6 +81,33 @@ describe SubmoduleHelper do end end + context 'submodule on gist.github.com' do + it 'detects ssh' do + stub_url('git@gist.github.com:gitlab-org/gitlab-foss.git') + is_expected.to eq(['https://gist.github.com/gitlab-org/gitlab-foss', 'https://gist.github.com/gitlab-org/gitlab-foss/hash']) + end + + it 'detects http' do + stub_url('http://gist.github.com/gitlab-org/gitlab-foss.git') + is_expected.to eq(['https://gist.github.com/gitlab-org/gitlab-foss', 'https://gist.github.com/gitlab-org/gitlab-foss/hash']) + end + + it 'detects https' do + stub_url('https://gist.github.com/gitlab-org/gitlab-foss.git') + is_expected.to eq(['https://gist.github.com/gitlab-org/gitlab-foss', 'https://gist.github.com/gitlab-org/gitlab-foss/hash']) + end + + it 'handles urls with no .git on the end' do + stub_url('http://gist.github.com/gitlab-org/gitlab-foss') + is_expected.to eq(['https://gist.github.com/gitlab-org/gitlab-foss', 'https://gist.github.com/gitlab-org/gitlab-foss/hash']) + end + + it 'returns original with non-standard url' do + stub_url('http://gist.github.com/another/gitlab-org/gitlab-foss.git') + is_expected.to eq([repo.submodule_url_for, nil]) + end + end + context 'submodule on github.com' do it 'detects ssh' do stub_url('git@github.com:gitlab-org/gitlab-foss.git') |