mirror of
https://github.com/discourse/discourse.git
synced 2025-02-24 04:02:28 +08:00

Follow up to #26712 to account for older threads that don't have a persisted excerpt, as this was previously generated on every page load. This change allows us to build the excerpt on the fly when none exists, fixing the issue of missing message excerpts for thread previews (within channel) and thread lists (on mobile/desktop).
30 lines
565 B
Ruby
30 lines
565 B
Ruby
# frozen_string_literal: true
|
|
|
|
describe Chat::NullMessage do
|
|
subject(:null_message) { described_class.new }
|
|
|
|
describe "#user" do
|
|
it "returns nil" do
|
|
expect(null_message.user).to be_nil
|
|
end
|
|
end
|
|
|
|
describe "#build_excerpt" do
|
|
it "returns nil" do
|
|
expect(null_message.build_excerpt).to be_nil
|
|
end
|
|
end
|
|
|
|
describe "#id" do
|
|
it "returns nil" do
|
|
expect(null_message.id).to be_nil
|
|
end
|
|
end
|
|
|
|
describe "#create_at" do
|
|
it "returns a Time object" do
|
|
expect(null_message.created_at).to be_a(Time)
|
|
end
|
|
end
|
|
end
|