FEATURE: Permalinks for users (#25552)

This commit is contained in:
Gerhard Schlager
2024-02-05 17:31:31 +01:00
committed by GitHub
parent 4b2be8c6b3
commit dd5ca6cc4c
8 changed files with 70 additions and 2 deletions

View File

@ -31,6 +31,7 @@ RSpec.describe Permalink do
let(:post) { Fabricate(:post, topic: topic) }
let(:category) { Fabricate(:category) }
let(:tag) { Fabricate(:tag) }
let(:user) { Fabricate(:user) }
it "returns a topic url when topic_id is set" do
permalink.topic_id = topic.id
@ -96,5 +97,15 @@ RSpec.describe Permalink do
it "returns nil when nothing is set" do
expect(target_url).to eq(nil)
end
it "returns a user url when user_id is set" do
permalink.user_id = user.id
expect(target_url).to eq(user.full_url)
end
it "returns nil when user_id is set but user is not found" do
permalink.user_id = 99_999
expect(target_url).to eq(nil)
end
end
end