Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-02-10 03:15:43 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-10 03:15:43 +0300
commitdd28adcbf0a6eea094968826799a24bbaac12262 (patch)
tree888829c0baea614dcf50d31d9887ee9e35836012 /spec/lib/extracts_ref_spec.rb
parent2744f5f9d735d892fad519329ba61544455e5279 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/extracts_ref_spec.rb')
-rw-r--r--spec/lib/extracts_ref_spec.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/spec/lib/extracts_ref_spec.rb b/spec/lib/extracts_ref_spec.rb
index 3cdce150de9..3e9a7499fdd 100644
--- a/spec/lib/extracts_ref_spec.rb
+++ b/spec/lib/extracts_ref_spec.rb
@@ -10,7 +10,8 @@ RSpec.describe ExtractsRef do
let_it_be(:container) { create(:snippet, :repository, author: owner) }
let(:ref) { sample_commit[:id] }
- let(:params) { { path: sample_commit[:line_code_path], ref: ref } }
+ let(:path) { sample_commit[:line_code_path] }
+ let(:params) { ActionController::Parameters.new(path: path, ref: ref) }
before do
ref_names = ['master', 'foo/bar/baz', 'v1.0.0', 'v2.0.0', 'release/app', 'release/app/v1.0.0']
@@ -23,7 +24,8 @@ RSpec.describe ExtractsRef do
it_behaves_like 'assigns ref vars'
context 'ref and path are nil' do
- let(:params) { { path: nil, ref: nil } }
+ let(:ref) { nil }
+ let(:path) { nil }
it 'does not set commit' do
expect(container.repository).not_to receive(:commit).with('')
@@ -33,6 +35,15 @@ RSpec.describe ExtractsRef do
expect(@commit).to be_nil
end
end
+
+ context 'when ref and path have incorrect format' do
+ let(:ref) { { wrong: :format } }
+ let(:path) { { also: :wrong } }
+
+ it 'does not raise an exception' do
+ expect { assign_ref_vars }.not_to raise_error
+ end
+ end
end
it_behaves_like 'extracts refs'