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

branch_names_settings_spec.rb « settings « projects « features « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1b82e8edb00472134f6c98cdfdf521cdec0c9b06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Project settings > repositories > Branch names', :js, feature_category: :source_code_management 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