about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-01-27 14:23:24 +0100
committerGitHub <noreply@github.com>2019-01-27 14:23:24 +0100
commitf1adce7f6dfb5cdd36f53f939a006e4d81594229 (patch)
tree6713004ab36f14228903d14cd1d4967228479e64 /spec
parentf938800ef4fcd7f63310e3f1d021c809f60ea448 (diff)
parent7251bc385389f3cdfe3f141d6df59bf499be3636 (diff)
Merge pull request #899 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'spec')
-rw-r--r--spec/services/post_status_service_spec.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/spec/services/post_status_service_spec.rb b/spec/services/post_status_service_spec.rb
index 680cebbcf..facbe977f 100644
--- a/spec/services/post_status_service_spec.rb
+++ b/spec/services/post_status_service_spec.rb
@@ -167,7 +167,7 @@ RSpec.describe PostStatusService, type: :service do
 
   it 'attaches the given media to the created status' do
     account = Fabricate(:account)
-    media = Fabricate(:media_attachment)
+    media = Fabricate(:media_attachment, account: account)
 
     status = subject.call(
       account,
@@ -178,6 +178,19 @@ RSpec.describe PostStatusService, type: :service do
     expect(media.reload.status).to eq status
   end
 
+  it 'does not attach media from another account to the created status' do
+    account = Fabricate(:account)
+    media = Fabricate(:media_attachment, account: Fabricate(:account))
+
+    status = subject.call(
+      account,
+      text: "test status update",
+      media_ids: [media.id],
+    )
+
+    expect(media.reload.status).to eq nil
+  end
+
   it 'does not allow attaching more than 4 files' do
     account = Fabricate(:account)