about summary refs log tree commit diff
path: root/spec/models
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-01-23 21:40:03 +0100
committermultiple creatures <dev@multiple-creature.party>2020-02-21 03:32:42 -0600
commite6bb4bd747a0120dd0207aecbb7c5c67b7caa165 (patch)
tree8685b5ce824c9d348620cdf6c6acc33875f9b3c8 /spec/models
parentc8159e7ccbb0d34e4698d0d7a6312ab439e0ca5f (diff)
port tootsuite#12562 to monsterfork: Fix media attachments without file being uploadable
Fix #12554
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/media_attachment_spec.rb13
1 files changed, 5 insertions, 8 deletions
diff --git a/spec/models/media_attachment_spec.rb b/spec/models/media_attachment_spec.rb
index af22a9812..e823f1713 100644
--- a/spec/models/media_attachment_spec.rb
+++ b/spec/models/media_attachment_spec.rb
@@ -31,14 +31,6 @@ RSpec.describe MediaAttachment, type: :model do
     context 'file is blank' do
       let(:file) { nil }
 
-      context 'remote_url is blank' do
-        let(:remote_url) { '' }
-
-        it 'returns false' do
-          is_expected.to be false
-        end
-      end
-
       context 'remote_url is present' do
         let(:remote_url) { 'remote_url' }
 
@@ -153,6 +145,11 @@ RSpec.describe MediaAttachment, type: :model do
     end
   end
 
+  it 'is invalid without file' do
+    media = MediaAttachment.new(account: Fabricate(:account))
+    expect(media.valid?).to be false
+  end
+
   describe 'descriptions for remote attachments' do
     it 'are cut off at 666 characters' do
       media = Fabricate(:media_attachment, description: 'foo' * 1000, remote_url: 'http://example.com/blah.jpg')