summaryrefslogtreecommitdiff
path: root/spec/services/projects
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-05-04 10:47:10 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-05-04 10:47:10 +0000
commitba608dc0f2c2377f7ca2095a8bc4e5d44921b67f (patch)
treea5540d9278c738f216f2bdc2f4a290c2a5e75cf7 /spec/services/projects
parentef71bf6278759aafb1a480916cfafb9c9650eddc (diff)
parent43ff7386411af0f538710f3627622f71e5e34472 (diff)
downloadgitlab-ce-ba608dc0f2c2377f7ca2095a8bc4e5d44921b67f.tar.gz
Merge branch '12910-uploader-pers-snippet' into 'master'
Prepare uploaders for personal snippets comments See merge request !11022
Diffstat (limited to 'spec/services/projects')
-rw-r--r--spec/services/projects/upload_service_spec.rb73
1 files changed, 0 insertions, 73 deletions
diff --git a/spec/services/projects/upload_service_spec.rb b/spec/services/projects/upload_service_spec.rb
deleted file mode 100644
index d2cefa46bfa..00000000000
--- a/spec/services/projects/upload_service_spec.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-require 'spec_helper'
-
-describe Projects::UploadService, services: true do
- describe 'File service' do
- before do
- @user = create(:user)
- @project = create(:empty_project, creator_id: @user.id, namespace: @user.namespace)
- end
-
- context 'for valid gif file' do
- before do
- gif = fixture_file_upload(Rails.root + 'spec/fixtures/banana_sample.gif', 'image/gif')
- @link_to_file = upload_file(@project, gif)
- end
-
- it { expect(@link_to_file).to have_key(:alt) }
- it { expect(@link_to_file).to have_key(:url) }
- it { expect(@link_to_file).to have_value('banana_sample') }
- it { expect(@link_to_file[:url]).to match('banana_sample.gif') }
- end
-
- context 'for valid png file' do
- before do
- png = fixture_file_upload(Rails.root + 'spec/fixtures/dk.png',
- 'image/png')
- @link_to_file = upload_file(@project, png)
- end
-
- it { expect(@link_to_file).to have_key(:alt) }
- it { expect(@link_to_file).to have_key(:url) }
- it { expect(@link_to_file).to have_value('dk') }
- it { expect(@link_to_file[:url]).to match('dk.png') }
- end
-
- context 'for valid jpg file' do
- before do
- jpg = fixture_file_upload(Rails.root + 'spec/fixtures/rails_sample.jpg', 'image/jpg')
- @link_to_file = upload_file(@project, jpg)
- end
-
- it { expect(@link_to_file).to have_key(:alt) }
- it { expect(@link_to_file).to have_key(:url) }
- it { expect(@link_to_file).to have_value('rails_sample') }
- it { expect(@link_to_file[:url]).to match('rails_sample.jpg') }
- end
-
- context 'for txt file' do
- before do
- txt = fixture_file_upload(Rails.root + 'spec/fixtures/doc_sample.txt', 'text/plain')
- @link_to_file = upload_file(@project, txt)
- end
-
- it { expect(@link_to_file).to have_key(:alt) }
- it { expect(@link_to_file).to have_key(:url) }
- it { expect(@link_to_file).to have_value('doc_sample.txt') }
- it { expect(@link_to_file[:url]).to match('doc_sample.txt') }
- end
-
- context 'for too large a file' do
- before do
- txt = fixture_file_upload(Rails.root + 'spec/fixtures/doc_sample.txt', 'text/plain')
- allow(txt).to receive(:size) { 1000.megabytes.to_i }
- @link_to_file = upload_file(@project, txt)
- end
-
- it { expect(@link_to_file).to eq(nil) }
- end
- end
-
- def upload_file(project, file)
- Projects::UploadService.new(project, file).execute
- end
-end