diff options
author | Robert Speicher <robert@gitlab.com> | 2018-05-02 22:11:45 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2018-05-02 22:11:45 +0300 |
commit | ab6dd3ac57dfff6472f6ecac21154fada9aa8d65 (patch) | |
tree | 36273df1ba7754757a2eb34454d61fd64c40a55a /spec/features/projects | |
parent | b01221cc9e02c09fa259a5c4c71eb559e77816fe (diff) | |
parent | 9ec4b5c9b65f40a71ca94d2f318da4adf9309a2e (diff) |
Merge branch '10-7-stable-patch-3' into '10-7-stable'
Prepare 10.7.3 release
See merge request gitlab-org/gitlab-ce!18647
Diffstat (limited to 'spec/features/projects')
-rw-r--r-- | spec/features/projects/blobs/user_creates_new_blob_in_new_project_spec.rb | 52 | ||||
-rw-r--r-- | spec/features/projects/user_views_empty_project_spec.rb | 43 |
2 files changed, 95 insertions, 0 deletions
diff --git a/spec/features/projects/blobs/user_creates_new_blob_in_new_project_spec.rb b/spec/features/projects/blobs/user_creates_new_blob_in_new_project_spec.rb new file mode 100644 index 00000000000..b7d063596c1 --- /dev/null +++ b/spec/features/projects/blobs/user_creates_new_blob_in_new_project_spec.rb @@ -0,0 +1,52 @@ +require 'spec_helper' + +feature 'User creates blob in new project', :js do + let(:user) { create(:user) } + let(:project) { create(:project, :empty_repo) } + + shared_examples 'creating a file' do + before do + sign_in(user) + visit project_path(project) + end + + it 'allows the user to add a new file' do + click_link 'New file' + + find('#editor') + execute_script('ace.edit("editor").setValue("Hello world")') + + fill_in(:file_name, with: 'dummy-file') + + click_button('Commit changes') + + expect(page).to have_content('The file has been successfully created') + end + end + + describe 'as a master' do + before do + project.add_master(user) + end + + it_behaves_like 'creating a file' + end + + describe 'as an admin' do + let(:user) { create(:user, :admin) } + + it_behaves_like 'creating a file' + end + + describe 'as a developer' do + before do + project.add_developer(user) + sign_in(user) + visit project_path(project) + end + + it 'does not allow pushing to the default branch' do + expect(page).not_to have_content('New file') + end + end +end 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 |