about summary refs log tree commit diff
path: root/spec/lib
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-10-31 18:25:34 +0100
committerGitHub <noreply@github.com>2022-10-31 18:25:34 +0100
commit968f34300681d8082cf2f824722a3945fc604b2d (patch)
tree910675cc3b8d9022f65bcfa9bee1acee6af8d0e4 /spec/lib
parent371563b0e249b6369e04709fb974a8e57413529f (diff)
parent1fe4e5e38c17a726e6aea5d6033139653e89a379 (diff)
Merge pull request #1876 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/permalink_redirector_spec.rb31
-rw-r--r--spec/lib/vacuum/preview_cards_vacuum_spec.rb4
2 files changed, 11 insertions, 24 deletions
diff --git a/spec/lib/permalink_redirector_spec.rb b/spec/lib/permalink_redirector_spec.rb
index abda57da4..a00913656 100644
--- a/spec/lib/permalink_redirector_spec.rb
+++ b/spec/lib/permalink_redirector_spec.rb
@@ -3,40 +3,31 @@
 require 'rails_helper'
 
 describe PermalinkRedirector do
+  let(:remote_account) { Fabricate(:account, username: 'alice', domain: 'example.com', url: 'https://example.com/@alice', id: 2) }
+
   describe '#redirect_url' do
     before do
-      account = Fabricate(:account, username: 'alice', id: 1)
-      Fabricate(:status, account: account, id: 123)
+      Fabricate(:status, account: remote_account, id: 123, url: 'https://example.com/status-123')
     end
 
     it 'returns path for legacy account links' do
-      redirector = described_class.new('web/accounts/1')
-      expect(redirector.redirect_path).to eq 'https://cb6e6126.ngrok.io/@alice'
+      redirector = described_class.new('accounts/2')
+      expect(redirector.redirect_path).to eq 'https://example.com/@alice'
     end
 
     it 'returns path for legacy status links' do
-      redirector = described_class.new('web/statuses/123')
-      expect(redirector.redirect_path).to eq 'https://cb6e6126.ngrok.io/@alice/123'
-    end
-
-    it 'returns path for legacy tag links' do
-      redirector = described_class.new('web/timelines/tag/hoge')
-      expect(redirector.redirect_path).to be_nil
+      redirector = described_class.new('statuses/123')
+      expect(redirector.redirect_path).to eq 'https://example.com/status-123'
     end
 
     it 'returns path for pretty account links' do
-      redirector = described_class.new('web/@alice')
-      expect(redirector.redirect_path).to eq 'https://cb6e6126.ngrok.io/@alice'
+      redirector = described_class.new('@alice@example.com')
+      expect(redirector.redirect_path).to eq 'https://example.com/@alice'
     end
 
     it 'returns path for pretty status links' do
-      redirector = described_class.new('web/@alice/123')
-      expect(redirector.redirect_path).to eq 'https://cb6e6126.ngrok.io/@alice/123'
-    end
-
-    it 'returns path for pretty tag links' do
-      redirector = described_class.new('web/tags/hoge')
-      expect(redirector.redirect_path).to be_nil
+      redirector = described_class.new('@alice/123')
+      expect(redirector.redirect_path).to eq 'https://example.com/status-123'
     end
   end
 end
diff --git a/spec/lib/vacuum/preview_cards_vacuum_spec.rb b/spec/lib/vacuum/preview_cards_vacuum_spec.rb
index 4a4a599fa..275f9ba92 100644
--- a/spec/lib/vacuum/preview_cards_vacuum_spec.rb
+++ b/spec/lib/vacuum/preview_cards_vacuum_spec.rb
@@ -28,9 +28,5 @@ RSpec.describe Vacuum::PreviewCardsVacuum do
     it 'does not delete attached preview cards' do
       expect(new_preview_card.reload).to be_persisted
     end
-
-    it 'deletes preview cards not attached to any status' do
-      expect { orphaned_preview_card.reload }.to raise_error ActiveRecord::RecordNotFound
-    end
   end
 end