BigW Consortium Gitlab

branches_spec.rb 1.28 KB
Newer Older
1 2 3
require 'spec_helper'

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

7 8 9 10 11
  context 'logged in' do
    before do
      login_as :user
      project.team << [@user, :developer]
    end
12

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

17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
        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
32 33 34
    end
  end

35 36
  context 'logged out' do
    before do
Connor Shea committed
37
      visit namespace_project_branches_path(project.namespace, project)
38
    end
39

40 41 42 43
    it 'does not show merge request button' do
      page.within first('.all-branches li') do
        expect(page).not_to have_content 'Merge Request'
      end
44 45 46
    end
  end
end