about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-09-12 18:22:43 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-09-12 18:22:43 +0200
commitce29624c6df83699a01808d68c19a2492864ffe8 (patch)
tree822f151d24ab6c04f20b0926f6290621c476e032 /spec
parent3d566279cb84aba6d07eaadebda6c059f2a58657 (diff)
Fixing image upload limits, allowing webm, merge/unmerge events trigger
timeline reload in UI, other small fixes
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/api/media_controller_spec.rb50
-rw-r--r--spec/fixtures/files/attachment.webmbin0 -> 653991 bytes
2 files changed, 37 insertions, 13 deletions
diff --git a/spec/controllers/api/media_controller_spec.rb b/spec/controllers/api/media_controller_spec.rb
index 2f216c1d5..e6c44cc9f 100644
--- a/spec/controllers/api/media_controller_spec.rb
+++ b/spec/controllers/api/media_controller_spec.rb
@@ -11,24 +11,48 @@ RSpec.describe Api::MediaController, type: :controller do
   end
 
   describe 'POST #create' do
-    before do
-      post :create, params: { file: fixture_file_upload('files/attachment.jpg', 'image/jpeg') }
+    context 'image/jpeg' do
+      before do
+        post :create, params: { file: fixture_file_upload('files/attachment.jpg', 'image/jpeg') }
+      end
+
+      it 'returns http success' do
+        expect(response).to have_http_status(:success)
+      end
+
+      it 'creates a media attachment' do
+        expect(MediaAttachment.first).to_not be_nil
+      end
+
+      it 'uploads a file' do
+        expect(MediaAttachment.first).to have_attached_file(:file)
+      end
+
+      it 'returns media ID in JSON' do
+        expect(body_as_json[:id]).to eq MediaAttachment.first.id
+      end
     end
 
-    it 'returns http success' do
-      expect(response).to have_http_status(:success)
-    end
+    context 'video/webm' do
+      before do
+        post :create, params: { file: fixture_file_upload('files/attachment.webm', 'video/webm') }
+      end
 
-    it 'creates a media attachment' do
-      expect(MediaAttachment.first).to_not be_nil
-    end
+      xit 'returns http success' do
+        expect(response).to have_http_status(:success)
+      end
 
-    it 'uploads a file' do
-      expect(MediaAttachment.first).to have_attached_file(:file)
-    end
+      xit 'creates a media attachment' do
+        expect(MediaAttachment.first).to_not be_nil
+      end
+
+      xit 'uploads a file' do
+        expect(MediaAttachment.first).to have_attached_file(:file)
+      end
 
-    it 'returns media ID in JSON' do
-      expect(body_as_json[:id]).to eq MediaAttachment.first.id
+      xit 'returns media ID in JSON' do
+        expect(body_as_json[:id]).to eq MediaAttachment.first.id
+      end
     end
   end
 end
diff --git a/spec/fixtures/files/attachment.webm b/spec/fixtures/files/attachment.webm
new file mode 100644
index 000000000..3babe5cf5
--- /dev/null
+++ b/spec/fixtures/files/attachment.webm
Binary files differ