diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-03-21 14:16:17 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-03-21 14:16:17 +0000 |
commit | a08c707c928092426e2334423e71c6b841309ddf (patch) | |
tree | 48c902d1be24f241c98787d52b114ae9973eb10a /spec/features/projects/user_create_dir_spec.rb | |
parent | 0ebf14621fe02adbf874bcb694a7be78794ec89c (diff) | |
parent | 7b04b63eeb8e3d6730acec3045a54f95968b3dac (diff) | |
download | gitlab-ce-a08c707c928092426e2334423e71c6b841309ddf.tar.gz |
Merge branch '29428-new-directory-from-existing-branch' into 'master'
New directory from interface on existing branch
Closes #29428
See merge request !9921
Diffstat (limited to 'spec/features/projects/user_create_dir_spec.rb')
-rw-r--r-- | spec/features/projects/user_create_dir_spec.rb | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/spec/features/projects/user_create_dir_spec.rb b/spec/features/projects/user_create_dir_spec.rb new file mode 100644 index 00000000000..2065abfb248 --- /dev/null +++ b/spec/features/projects/user_create_dir_spec.rb @@ -0,0 +1,72 @@ +require 'spec_helper' + +feature 'New directory creation', feature: true, js: true do + include WaitForAjax + include TargetBranchHelpers + + given(:user) { create(:user) } + given(:role) { :developer } + given(:project) { create(:project) } + + background do + login_as(user) + project.team << [user, role] + visit namespace_project_tree_path(project.namespace, project, 'master') + open_new_directory_modal + fill_in 'dir_name', with: 'new_directory' + end + + def open_new_directory_modal + first('.add-to-tree').click + click_link 'New directory' + end + + def create_directory + click_button 'Create directory' + end + + context 'with default target branch' do + background do + create_directory + end + + scenario 'creates the directory in the default branch' do + expect(page).to have_content 'master' + expect(page).to have_content 'The directory has been successfully created' + expect(page).to have_content 'new_directory' + end + end + + context 'with different target branch' do + background do + select_branch('feature') + create_directory + end + + scenario 'creates the directory in the different branch' do + expect(page).to have_content 'feature' + expect(page).to have_content 'The directory has been successfully created' + end + end + + context 'with a new target branch' do + given(:new_branch_name) { 'new-feature' } + + background do + create_new_branch(new_branch_name) + create_directory + end + + scenario 'creates the directory in the new branch' do + expect(page).to have_content new_branch_name + expect(page).to have_content 'The directory has been successfully created' + end + + scenario 'redirects to the merge request' do + expect(page).to have_content 'New Merge Request' + expect(page).to have_content "From #{new_branch_name} into master" + expect(page).to have_content 'Add new directory' + expect(current_path).to eq(new_namespace_project_merge_request_path(project.namespace, project)) + end + end +end |