diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-22 18:09:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-22 18:09:14 +0300 |
commit | 3a8d221b7e3dc909876fe60ac267e63d1ffffdd7 (patch) | |
tree | 413b11d1687aa52f8929dda7fbca655ff9938a0b /spec/views | |
parent | a27c21b5af4f60ff11706f85289065272c616a0c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/projects/runners/_project_runners.html.haml_spec.rb | 59 |
1 files changed, 10 insertions, 49 deletions
diff --git a/spec/views/projects/runners/_project_runners.html.haml_spec.rb b/spec/views/projects/runners/_project_runners.html.haml_spec.rb index d96b77b368c..7dd5e829686 100644 --- a/spec/views/projects/runners/_project_runners.html.haml_spec.rb +++ b/spec/views/projects/runners/_project_runners.html.haml_spec.rb @@ -15,66 +15,27 @@ RSpec.describe 'projects/runners/_project_runners.html.haml', feature_category: allow(view).to receive(:reset_registration_token_namespace_project_settings_ci_cd_path).and_return('banana_url') end - context 'when create_runner_workflow_for_namespace is disabled' do + context 'when user can create project runner' do before do - stub_feature_flags(create_runner_workflow_for_namespace: false) + allow(view).to receive(:can?).with(user, :create_runner, project).and_return(true) end - context 'when project runner registration is allowed' do - before do - stub_application_setting(valid_runner_registrars: ['project']) - allow(view).to receive(:can?).with(user, :register_project_runners, project).and_return(true) - end + it 'renders the New project runner button' do + render 'projects/runners/project_runners', project: project - it 'enables the Remove project button for a project' do - render 'projects/runners/project_runners', project: project - - expect(rendered).to have_selector '#js-install-runner' - expect(rendered).not_to have_content 'Please contact an admin to register runners.' - end - end - - context 'when project runner registration is not allowed' do - before do - stub_application_setting(valid_runner_registrars: ['group']) - end - - it 'does not enable the Remove project button for a project' do - render 'projects/runners/project_runners', project: project - - expect(rendered).to have_content 'Please contact an admin to register runners.' - expect(rendered).not_to have_selector '#js-install-runner' - end + expect(rendered).to have_link(s_('Runners|New project runner'), href: new_project_runner_path(project)) end end - context 'when create_runner_workflow_for_namespace is enabled' do + context 'when user cannot create project runner' do before do - stub_feature_flags(create_runner_workflow_for_namespace: project.namespace) + allow(view).to receive(:can?).with(user, :create_runner, project).and_return(false) end - context 'when user can create project runner' do - before do - allow(view).to receive(:can?).with(user, :create_runner, project).and_return(true) - end - - it 'renders the New project runner button' do - render 'projects/runners/project_runners', project: project - - expect(rendered).to have_link(s_('Runners|New project runner'), href: new_project_runner_path(project)) - end - end - - context 'when user cannot create project runner' do - before do - allow(view).to receive(:can?).with(user, :create_runner, project).and_return(false) - end - - it 'does not render the New project runner button' do - render 'projects/runners/project_runners', project: project + it 'does not render the New project runner button' do + render 'projects/runners/project_runners', project: project - expect(rendered).not_to have_link(s_('Runners|New project runner')) - end + expect(rendered).not_to have_link(s_('Runners|New project runner')) end end end |