summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorwinniehell <git@winniehell.de>2016-12-13 02:10:30 +0100
committerwinniehell <git@winniehell.de>2016-12-13 09:13:06 +0100
commitc16b24af04643edc598b20b338eff25e463ed29b (patch)
tree80b201c0c33e4a6f463ca6d8bbdf45882ff6eac2 /spec
parent0d04db92efcbe6cb4a28c215d7e5f6762563ba75 (diff)
downloadgitlab-ce-c16b24af04643edc598b20b338eff25e463ed29b.tar.gz
Add failing test for #20190
Diffstat (limited to 'spec')
-rw-r--r--spec/features/projects/files/creating_a_file_spec.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/features/projects/files/creating_a_file_spec.rb b/spec/features/projects/files/creating_a_file_spec.rb
new file mode 100644
index 00000000000..ae448706130
--- /dev/null
+++ b/spec/features/projects/files/creating_a_file_spec.rb
@@ -0,0 +1,44 @@
+require 'spec_helper'
+
+feature 'User wants to create a file', feature: true do
+ include WaitForAjax
+
+ let(:project) { create(:project) }
+ let(:user) { create(:user) }
+
+ background do
+ project.team << [user, :master]
+ login_as user
+ visit namespace_project_new_blob_path(project.namespace, project, project.default_branch)
+ end
+
+ def submit_new_file(options)
+ file_name = find('#file_name')
+ file_name.set options[:file_name] || 'README.md'
+
+ file_content = find('#file-content')
+ file_content.set options[:file_content] || 'Some content'
+
+ click_button 'Commit Changes'
+ end
+
+ scenario 'file name contains Chinese characters' do
+ submit_new_file(file_name: '测试.md')
+ expect(page).to have_content 'The file has been successfully created.'
+ end
+
+ scenario 'directory name contains Chinese characters' do
+ submit_new_file(file_name: '中文/测试.md')
+ expect(page).to have_content 'The file has been successfully created.'
+ end
+
+ scenario 'file name contains invalid characters' do
+ submit_new_file(file_name: '\\')
+ expect(page).to have_content 'Your changes could not be committed, because the file name can contain only'
+ end
+
+ scenario 'file name contains directory traversal' do
+ submit_new_file(file_name: '../README.md')
+ expect(page).to have_content 'Your changes could not be committed, because the file name cannot include directory traversal.'
+ end
+end