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:
Diffstat (limited to 'spec/features/projects/settings/branch_names_settings_spec.rb')
-rw-r--r--spec/features/projects/settings/branch_names_settings_spec.rb48
1 files changed, 48 insertions, 0 deletions
diff --git a/spec/features/projects/settings/branch_names_settings_spec.rb b/spec/features/projects/settings/branch_names_settings_spec.rb
new file mode 100644
index 00000000000..fdd883bc2b6
--- /dev/null
+++ b/spec/features/projects/settings/branch_names_settings_spec.rb
@@ -0,0 +1,48 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'Project settings > repositories > Branch names', :js do
+ let_it_be(:project) { create(:project, :public) }
+ let(:user) { create(:user) }
+
+ before do
+ project.add_maintainer(user)
+
+ sign_in(user)
+ end
+
+ context 'when Issues are initially disabled' do
+ let(:project_feature) { project.project_feature }
+
+ before do
+ project_feature.update!(issues_access_level: ProjectFeature::DISABLED)
+ visit project_settings_repository_path(project)
+ end
+
+ it 'do not render the Branch names settings' do
+ expect(page).not_to have_content('Branch name template')
+ end
+ end
+
+ context 'when Issues are initially enabled' do
+ before do
+ visit project_settings_repository_path(project)
+ end
+
+ it 'shows the Branch names settings' do
+ expect(page).to have_content('Branch name template')
+
+ value = "feature-%{id}"
+
+ within('section#branch-defaults-settings') do
+ fill_in 'project[issue_branch_template]', with: value
+
+ click_on('Save changes')
+ end
+
+ expect(project.reload.issue_branch_template).to eq(value)
+ expect(page).to have_content('Branch name template')
+ end
+ end
+end