debian-mirror-gitlab/spec/features/projects/branches_spec.rb

47 lines
1.3 KiB
Ruby
Raw Normal View History

2016-08-24 12:49:21 +05:30
require 'spec_helper'
describe 'Branches', feature: true do
2016-09-29 09:46:39 +05:30
let(:project) { create(:project, :public) }
2016-08-24 12:49:21 +05:30
let(:repository) { project.repository }
2016-09-29 09:46:39 +05:30
context 'logged in' do
before do
login_as :user
project.team << [@user, :developer]
end
2016-08-24 12:49:21 +05:30
2016-09-29 09:46:39 +05:30
describe 'Initial branches page' do
it 'shows all the branches' do
visit namespace_project_branches_path(project.namespace, project)
2016-08-24 12:49:21 +05:30
2016-09-29 09:46:39 +05:30
repository.branches { |branch| expect(page).to have_content("#{branch.name}") }
expect(page).to have_content("Protected branches can be managed in project settings")
end
2016-08-24 12:49:21 +05:30
end
2016-09-29 09:46:39 +05:30
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)
2016-08-24 12:49:21 +05:30
2016-09-29 09:46:39 +05:30
expect(page).to have_content('fix')
expect(find('.all-branches')).to have_selector('li', count: 1)
end
end
end
context 'logged out' do
before do
visit namespace_project_branches_path(project.namespace, project)
end
2016-08-24 12:49:21 +05:30
2016-09-29 09:46:39 +05:30
it 'does not show merge request button' do
page.within first('.all-branches li') do
expect(page).not_to have_content 'Merge Request'
end
2016-08-24 12:49:21 +05:30
end
end
end