diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /spec/helpers/search_helper_spec.rb | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'spec/helpers/search_helper_spec.rb')
-rw-r--r-- | spec/helpers/search_helper_spec.rb | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/spec/helpers/search_helper_spec.rb b/spec/helpers/search_helper_spec.rb index 8e2ec014383..4117d577f20 100644 --- a/spec/helpers/search_helper_spec.rb +++ b/spec/helpers/search_helper_spec.rb @@ -534,24 +534,26 @@ RSpec.describe SearchHelper do end describe '#repository_ref' do + using RSpec::Parameterized::TableSyntax + let_it_be(:project) { create(:project, :repository) } - let(:params) { { repository_ref: 'the-repository-ref-param' } } + let(:default_branch) { project.default_branch } + let(:params) { { repository_ref: ref, project_id: project_id } } subject { repository_ref(project) } - it { is_expected.to eq('the-repository-ref-param') } - - context 'when the param :repository_ref is not set' do - let(:params) { { repository_ref: nil } } - - it { is_expected.to eq(project.default_branch) } + where(:project_id, :ref, :expected_ref) do + 123 | 'ref-param' | 'ref-param' + 123 | nil | ref(:default_branch) + 123 | 111111 | '111111' + nil | 'ref-param' | ref(:default_branch) end - context 'when the repository_ref param is a number' do - let(:params) { { repository_ref: 111111 } } - - it { is_expected.to eq('111111') } + with_them do + it 'returns expected_ref' do + expect(repository_ref(project)).to eq(expected_ref) + end end end |