about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/media_controller_spec.rb6
-rw-r--r--spec/lib/activitypub/tag_manager_spec.rb8
2 files changed, 11 insertions, 3 deletions
diff --git a/spec/controllers/media_controller_spec.rb b/spec/controllers/media_controller_spec.rb
index 2925aed59..6651e9d84 100644
--- a/spec/controllers/media_controller_spec.rb
+++ b/spec/controllers/media_controller_spec.rb
@@ -8,14 +8,14 @@ describe MediaController do
   describe '#show' do
     it 'redirects to the file url when attached to a status' do
       status = Fabricate(:status)
-      media_attachment = Fabricate(:media_attachment, status: status)
+      media_attachment = Fabricate(:media_attachment, status: status, shortcode: 'foo')
       get :show, params: { id: media_attachment.to_param }
 
       expect(response).to redirect_to(media_attachment.file.url(:original))
     end
 
     it 'responds with missing when there is not an attached status' do
-      media_attachment = Fabricate(:media_attachment, status: nil)
+      media_attachment = Fabricate(:media_attachment, status: nil, shortcode: 'foo')
       get :show, params: { id: media_attachment.to_param }
 
       expect(response).to have_http_status(404)
@@ -29,7 +29,7 @@ describe MediaController do
 
     it 'raises when not permitted to view' do
       status = Fabricate(:status, visibility: :direct)
-      media_attachment = Fabricate(:media_attachment, status: status)
+      media_attachment = Fabricate(:media_attachment, status: status, shortcode: 'foo')
       get :show, params: { id: media_attachment.to_param }
 
       expect(response).to have_http_status(404)
diff --git a/spec/lib/activitypub/tag_manager_spec.rb b/spec/lib/activitypub/tag_manager_spec.rb
index 1c5c6f0ed..606a1de2e 100644
--- a/spec/lib/activitypub/tag_manager_spec.rb
+++ b/spec/lib/activitypub/tag_manager_spec.rb
@@ -42,6 +42,14 @@ RSpec.describe ActivityPub::TagManager do
       expect(subject.to(status)).to eq [subject.uri_for(mentioned)]
     end
 
+    it "returns URIs of mentioned group's followers for direct statuses to groups" do
+      status    = Fabricate(:status, visibility: :direct)
+      mentioned = Fabricate(:account, domain: 'remote.org', uri: 'https://remote.org/group', followers_url: 'https://remote.org/group/followers', actor_type: 'Group')
+      status.mentions.create(account: mentioned)
+      expect(subject.to(status)).to include(subject.uri_for(mentioned))
+      expect(subject.to(status)).to include(subject.followers_uri_for(mentioned))
+    end
+
     it "returns URIs of mentions for direct silenced author's status only if they are followers or requesting to be" do
       bob    = Fabricate(:account, username: 'bob')
       alice  = Fabricate(:account, username: 'alice')