diff options
author | Stan Hu <stanhu@gmail.com> | 2015-09-16 22:45:22 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-10-07 04:22:55 -0700 |
commit | 0ab6ca93aadaf08f65f36e7fbdb5b837bac6e160 (patch) | |
tree | b20c01f8a37413e401873e5fd1be5e07865b93ac /spec/controllers/projects | |
parent | 0611a18964a998b6edc81ef9b469f9f70430e542 (diff) | |
download | gitlab-ce-0ab6ca93aadaf08f65f36e7fbdb5b837bac6e160.tar.gz |
Add directory feature button
Change "+" icon under "Files" section to have three options:
* Create file
* Upload file
* New directory
Upload file is no longer accessible from the "Create file" page.
Users can now select a target branch in upload file as well.
Closes #2799: Fixes a bug where file modes were overwritten after a commit
Closes https://github.com/gitlabhq/gitlabhq/issues/8253: Existing files
can no longer be overwritten in the "Create file" section.
Closes #2557
Diffstat (limited to 'spec/controllers/projects')
-rw-r--r-- | spec/controllers/projects/tree_controller_spec.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/controllers/projects/tree_controller_spec.rb b/spec/controllers/projects/tree_controller_spec.rb index 53915856357..a474574c6e5 100644 --- a/spec/controllers/projects/tree_controller_spec.rb +++ b/spec/controllers/projects/tree_controller_spec.rb @@ -88,4 +88,40 @@ describe Projects::TreeController do end end end + + describe '#create_dir' do + render_views + + before do + post(:create_dir, + namespace_id: project.namespace.to_param, + project_id: project.to_param, + id: 'master', + dir_name: path, + new_branch: target_branch, + commit_message: 'Test commit message') + end + + context 'successful creation' do + let(:path) { 'files/new_dir'} + let(:target_branch) { 'master-test'} + + it 'redirects to the new directory' do + expect(subject). + to redirect_to("/#{project.path_with_namespace}/blob/#{target_branch}/#{path}") + expect(flash[:notice]).to eq('The directory has been successfully created') + end + end + + context 'unsuccessful creation' do + let(:path) { 'README.md' } + let(:target_branch) { 'master'} + + it 'does not allow overwriting of existing files' do + expect(subject). + to redirect_to("/#{project.path_with_namespace}/blob/master") + expect(flash[:alert]).to eq('Directory already exists as a file') + end + end + end end |