diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-16 18:06:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-16 18:06:17 +0300 |
commit | 00c78fb814d7ce00989ac04edd6cdaa3239da284 (patch) | |
tree | f04920f08eb4e481ce27bd1d96862676dff735dc /spec/lib/gitlab/submodule_links_spec.rb | |
parent | d2ffc30fd583e86d4122bb5061098f4f3ca7b3f1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/submodule_links_spec.rb')
-rw-r--r-- | spec/lib/gitlab/submodule_links_spec.rb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/spec/lib/gitlab/submodule_links_spec.rb b/spec/lib/gitlab/submodule_links_spec.rb index d4420c5b513..f0c8825de74 100644 --- a/spec/lib/gitlab/submodule_links_spec.rb +++ b/spec/lib/gitlab/submodule_links_spec.rb @@ -8,7 +8,9 @@ describe Gitlab::SubmoduleLinks do let(:links) { described_class.new(repo) } describe '#for' do - subject { links.for(submodule_item, 'ref') } + let(:ref) { 'ref' } + + subject { links.for(submodule_item, ref) } context 'when there is no .gitmodules file' do before do @@ -35,8 +37,20 @@ describe Gitlab::SubmoduleLinks do stub_urls({ 'gitlab-foss' => 'git@gitlab.com:gitlab-org/gitlab-foss.git' }) end - it 'returns links' do + it 'returns links and caches the by ref' do expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/tree/hash']) + + cache_store = links.instance_variable_get("@cache_store") + + expect(cache_store[ref]).to eq({ "gitlab-foss" => "git@gitlab.com:gitlab-org/gitlab-foss.git" }) + end + + context 'when ref name contains a dash' do + let(:ref) { 'signed-commits' } + + it 'returns links' do + expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/tree/hash']) + end end end end |