mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
improve erraticly failing spec
This commit is contained in:
parent
8e9531657a
commit
45f65859c9
@ -91,4 +91,8 @@ class RandomTopicSelector
|
|||||||
"random_topic_cache_#{category&.id}"
|
"random_topic_cache_#{category&.id}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.clear_cache!
|
||||||
|
$redis.delete_prefixed(cache_key)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -3,7 +3,12 @@ require 'rails_helper'
|
|||||||
describe TopicViewSerializer do
|
describe TopicViewSerializer do
|
||||||
def serialize_topic(topic, user_arg)
|
def serialize_topic(topic, user_arg)
|
||||||
topic_view = TopicView.new(topic.id, user_arg)
|
topic_view = TopicView.new(topic.id, user_arg)
|
||||||
described_class.new(topic_view, scope: Guardian.new(user_arg), root: false).as_json
|
TopicViewSerializer.new(topic_view, scope: Guardian.new(user_arg), root: false).as_json
|
||||||
|
end
|
||||||
|
|
||||||
|
before do
|
||||||
|
# ensure no suggested ids are cached cause that can muck up suggested
|
||||||
|
RandomTopicSelector.clear_cache!
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:topic) { Fabricate(:topic) }
|
let(:topic) { Fabricate(:topic) }
|
||||||
|
Loading…
Reference in New Issue
Block a user