Commit a89ba59b authored by Miguel Rincon's avatar Miguel Rincon

Merge branch...

Merge branch '334981-an-error-occurred-fetching-the-status-checks-when-viewing-project-settings' into 'master'

Add license flag to status checks settings

See merge request gitlab-org/gitlab!65246
parents 8664dd3a f9f6f513
......@@ -8,7 +8,7 @@
= render_ce 'projects/merge_request_merge_checks_settings', project: @project, form: form
- if ::Feature.enabled?(:ff_external_status_checks, @project, default_enabled: :yaml)
- if ::Feature.enabled?(:ff_external_status_checks, @project, default_enabled: :yaml) && @project.licensed_feature_available?(:external_status_checks)
= render_if_exists 'projects/merge_request_status_checks_settings'
= render 'projects/merge_request_merge_suggestions_settings', project: @project, form: form
......@@ -22,8 +22,8 @@
%p.text-secondary
= s_('ProjectSettings|Used for every new merge request.')
- create_a_merge_request_template_help_link_url = help_page_path('user/project/description_templates', anchor: 'create-a-merge-request-template')
- create_a_merge_request_templates_elp_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: create_a_merge_request_template_help_link_url }
= s_('ProjectSettings|%{link_start}What are description templates?%{link_end}').html_safe % { link_start: create_a_merge_request_templates_elp_link_start, link_end: '</a>'.html_safe }
- create_a_merge_request_templates_help_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: create_a_merge_request_template_help_link_url }
= s_('ProjectSettings|%{link_start}What are description templates?%{link_end}').html_safe % { link_start: create_a_merge_request_templates_help_link_start, link_end: '</a>'.html_safe }
= form.text_area :merge_requests_template, class: "form-control", rows: 3, data: { qa_selector: 'default_merge_request_template_field' }
......
......@@ -17,9 +17,9 @@ RSpec.describe 'Project settings > [EE] Merge Requests', :js do
end
context 'Status checks' do
context 'Feature is not available' do
context 'Feature flag is disabled' do
before do
stub_licensed_features(external_status_checks: false)
stub_feature_flags(ff_external_status_checks: false)
end
it 'does not render the status checks area' do
......@@ -27,67 +27,83 @@ RSpec.describe 'Project settings > [EE] Merge Requests', :js do
end
end
context 'Feature is available' do
context 'Feature flag is enabled' do
before do
stub_licensed_features(external_status_checks: true)
stub_feature_flags(ff_external_status_checks: true)
end
it 'adds a status check' do
visit edit_project_path(project)
click_button 'Add status check'
within('.modal-content') do
find('[data-testid="name"]').set('My new check')
find('[data-testid="url"]').set('https://api.gitlab.com')
click_button 'Add status check'
context 'Feature is not available' do
before do
stub_licensed_features(external_status_checks: false)
end
wait_for_requests
expect(find('[data-testid="status-checks-table"]')).to have_content('My new check')
it 'does not render the status checks area' do
expect(page).not_to have_selector('[data-testid="status-checks-table"]')
end
end
context 'with a status check' do
let_it_be(:rule) { create(:external_status_check, project: project) }
context 'Feature is available' do
before do
stub_licensed_features(external_status_checks: true)
end
it 'updates the status check' do
it 'adds a status check' do
visit edit_project_path(project)
expect(find('[data-testid="status-checks-table"]')).to have_content(rule.name)
within('[data-testid="status-checks-table"]') do
click_button 'Edit'
end
click_button 'Add status check'
within('.modal-content') do
find('[data-testid="name"]').set('Something new')
find('[data-testid="name"]').set('My new check')
find('[data-testid="url"]').set('https://api.gitlab.com')
click_button 'Update status check'
click_button 'Add status check'
end
wait_for_requests
expect(find('[data-testid="status-checks-table"]')).to have_content('Something new')
expect(find('[data-testid="status-checks-table"]')).to have_content('My new check')
end
it 'removes the status check' do
visit edit_project_path(project)
context 'with a status check' do
let_it_be(:rule) { create(:external_status_check, project: project) }
expect(find('[data-testid="status-checks-table"]')).to have_content(rule.name)
it 'updates the status check' do
visit edit_project_path(project)
within('[data-testid="status-checks-table"]') do
click_button 'Remove...'
end
expect(find('[data-testid="status-checks-table"]')).to have_content(rule.name)
within('.modal-content') do
click_button 'Remove status check'
within('[data-testid="status-checks-table"]') do
click_button 'Edit'
end
within('.modal-content') do
find('[data-testid="name"]').set('Something new')
click_button 'Update status check'
end
wait_for_requests
expect(find('[data-testid="status-checks-table"]')).to have_content('Something new')
end
wait_for_requests
it 'removes the status check' do
visit edit_project_path(project)
expect(find('[data-testid="status-checks-table"]')).to have_content(rule.name)
within('[data-testid="status-checks-table"]') do
click_button 'Remove...'
end
expect(find('[data-testid="status-checks-table"]')).not_to have_content(rule.name)
within('.modal-content') do
click_button 'Remove status check'
end
wait_for_requests
expect(find('[data-testid="status-checks-table"]')).not_to have_content(rule.name)
end
end
end
end
......
......@@ -16,27 +16,45 @@ RSpec.describe 'projects/edit' do
end
context 'status checks' do
context 'feature enabled' do
context 'feature flag is disabled' do
before do
stub_feature_flags(ff_external_status_checks: true)
stub_feature_flags(ff_external_status_checks: false)
render
end
it 'shows the status checks area' do
expect(rendered).to have_content('Status check')
it 'hides the status checks area' do
expect(rendered).not_to have_content('Status check')
end
end
context 'feature disabled' do
context 'feature flag is enabled' do
before do
stub_feature_flags(ff_external_status_checks: false)
stub_feature_flags(ff_external_status_checks: true)
end
render
context 'feature is not available' do
before do
stub_licensed_features(external_status_checks: false)
render
end
it 'hides the status checks area' do
expect(rendered).not_to have_content('Status check')
end
end
it 'hides the status checks area' do
expect(rendered).not_to have_content('Status check')
context 'feature is available' do
before do
stub_licensed_features(external_status_checks: true)
render
end
it 'shows the status checks area' do
expect(rendered).to have_content('Status check')
end
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment