summaryrefslogtreecommitdiff
path: root/spec/features/projects/branches_spec.rb
blob: 1b14945bf0a7fbd951f239a05abe3752c3725719 (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
require 'spec_helper'

describe 'Branches', feature: true do
  let(:project) { create(:project) }
  let(:repository) { project.repository }

  before do
    login_as :user
    project.team << [@user, :developer]
  end

  describe 'Initial branches page' do
    it 'shows all the branches' do
      visit namespace_project_branches_path(project.namespace, project)

      repository.branches { |branch| expect(page).to have_content("#{branch.name}") }
      expect(page).to have_content("Protected branches can be managed in project settings")
    end
  end

  describe 'Find branches' do
    it 'shows filtered branches', js: true do
      visit namespace_project_branches_path(project.namespace, project)

      fill_in 'branch-search', with: 'fix'
      find('#branch-search').native.send_keys(:enter)

      expect(page).to have_content('fix')
      expect(find('.all-branches')).to have_selector('li', count: 1)
    end
  end
end