summaryrefslogtreecommitdiff
path: root/spec/features/projects/branches_spec.rb
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-09-02 14:33:24 +0100
committerPhil Hughes <me@iamphill.com>2016-09-02 14:33:24 +0100
commit315e6392cd5f4e35fd44d0d24637ea377604b754 (patch)
tree58473e0dfbef1bf207ec51d19d2596ba032b78e5 /spec/features/projects/branches_spec.rb
parenta5d1428a91c16f07b73cf62401f9513db5fb85b7 (diff)
downloadgitlab-ce-315e6392cd5f4e35fd44d0d24637ea377604b754.tar.gz
Hides merge request button on branches pagebranches-mr-button-permissions
If user does not have the correct permissions, the merge request button is hidden Closes #21805
Diffstat (limited to 'spec/features/projects/branches_spec.rb')
-rw-r--r--spec/features/projects/branches_spec.rb48
1 files changed, 31 insertions, 17 deletions
diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb
index 1b14945bf0a..d26a0caf036 100644
--- a/spec/features/projects/branches_spec.rb
+++ b/spec/features/projects/branches_spec.rb
@@ -1,32 +1,46 @@
require 'spec_helper'
describe 'Branches', feature: true do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :public) }
let(:repository) { project.repository }
- before do
- login_as :user
- project.team << [@user, :developer]
- end
+ context 'logged in' do
+ 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)
+ 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")
+ 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
- describe 'Find branches' do
- it 'shows filtered branches', js: true do
+ context 'logged out' do
+ before do
visit namespace_project_branches_path(project.namespace, project)
+ end
- 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)
+ it 'does not show merge request button' do
+ page.within first('.all-branches li') do
+ expect(page).not_to have_content 'Merge Request'
+ end
end
end
end