summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessio Caiazza <acaiazza@gitlab.com>2019-09-06 11:52:47 +0200
committerAlessio Caiazza <acaiazza@gitlab.com>2019-09-06 15:53:13 +0200
commit5b3ed2afe80fa9acff905433a99662d991e472ac (patch)
tree5f8e8d06c6068a9ca63ed7f9ab635e52093d91ab
parente32069ef6cb569c11e792dadacc4713871325d9d (diff)
downloadgitlab-ce-ac-accelerate-wiki-attachments.tar.gz
Test blob_controller POST createac-accelerate-wiki-attachments
-rw-r--r--spec/requests/projects/uploads_spec.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/requests/projects/uploads_spec.rb b/spec/requests/projects/uploads_spec.rb
new file mode 100644
index 00000000000..aca4644289d
--- /dev/null
+++ b/spec/requests/projects/uploads_spec.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe 'File uploads' do
+ include WorkhorseHelpers
+
+ let(:project) { create(:project, :public, :repository) }
+ let(:user) { create(:user) }
+
+ describe 'POST /:namespace/:project/create/:branch' do
+ let(:branch) { 'master' }
+ let(:create_url) { project_blob_path(project, branch) }
+ let(:blob_url) { project_blob_path(project, "#{branch}/dk.png") }
+ let(:params) do
+ {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: branch,
+ branch_name: branch,
+ file: fixture_file_upload('spec/fixtures/dk.png'),
+ commit_message: 'Add an image'
+ }
+ end
+
+ before do
+ project.add_maintainer(user)
+
+ login_as(user)
+ end
+
+ it 'redirects to blob' do
+ workhorse_post_with_file(create_url, file_key: :file, params: params)
+
+ expect(response).to redirect_to(blob_url)
+ end
+ end
+end