summaryrefslogtreecommitdiff
path: root/spec/features/projects
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-04-18 12:44:12 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2018-04-24 13:59:41 +0200
commitaeed6b5a34e2c1c98a374e6c6178d84e07779531 (patch)
treec9b169862980a0e651d66a9669d20eb1e558ce06 /spec/features/projects
parenta544f6ec58ba5f9cfbff6b59b50bc92bc2274bdb (diff)
downloadgitlab-ce-aeed6b5a34e2c1c98a374e6c6178d84e07779531.tar.gz
Only show push-to-master authorized users
Hide the push to master instructions for users that are not allowed to do that. Also hide buttons that would direct them to commit directly in master
Diffstat (limited to 'spec/features/projects')
-rw-r--r--spec/features/projects/user_views_empty_project_spec.rb43
1 files changed, 43 insertions, 0 deletions
diff --git a/spec/features/projects/user_views_empty_project_spec.rb b/spec/features/projects/user_views_empty_project_spec.rb
new file mode 100644
index 00000000000..7b982301ffc
--- /dev/null
+++ b/spec/features/projects/user_views_empty_project_spec.rb
@@ -0,0 +1,43 @@
+require 'spec_helper'
+
+describe 'User views an empty project' do
+ let(:project) { create(:project, :empty_repo) }
+ let(:user) { create(:user) }
+
+ shared_examples 'allowing push to default branch' do
+ before do
+ sign_in(user)
+ visit project_path(project)
+ end
+
+ it 'shows push-to-master instructions' do
+ expect(page).to have_content('git push -u origin master')
+ end
+ end
+
+ describe 'as a master' do
+ before do
+ project.add_master(user)
+ end
+
+ it_behaves_like 'allowing push to default branch'
+ end
+
+ describe 'as an admin' do
+ let(:user) { create(:user, :admin) }
+
+ it_behaves_like 'allowing push to default branch'
+ end
+
+ describe 'as a developer' do
+ before do
+ project.add_developer(user)
+ sign_in(user)
+ visit project_path(project)
+ end
+
+ it 'does not show push-to-master instructions' do
+ expect(page).not_to have_content('git push -u origin master')
+ end
+ end
+end