diff options
author | Douwe Maan <douwe@selenight.nl> | 2019-07-26 01:01:17 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-07-26 13:05:56 +0300 |
commit | cfef1e8e99c275386d3680b90e95ba0cdf137f7c (patch) | |
tree | e132592be1abb1f6bdf953296cc77a6c1f679fbd /spec/helpers | |
parent | 57aabe16b73890d798ab86dccb3a845aa25d5232 (diff) |
Fix error rendering submodules in MR diffs when there is no .gitmodules
Without this change, we get a NoMethodError on nil
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/submodule_helper_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/helpers/submodule_helper_spec.rb b/spec/helpers/submodule_helper_spec.rb index b922b910c89..ab4ef899119 100644 --- a/spec/helpers/submodule_helper_spec.rb +++ b/spec/helpers/submodule_helper_spec.rb @@ -229,6 +229,19 @@ describe SubmoduleHelper do end end end + + context 'unknown submodule' do + before do + # When there is no `.gitmodules` file, or if `.gitmodules` does not + # know the submodule at the specified path, + # `Repository#submodule_url_for` returns `nil` + stub_url(nil) + end + + it 'returns no links' do + expect(subject).to eq([nil, nil]) + end + end end context 'as view helpers in view context' do |