diff --git a/spec/serializers/topic_view_serializer_spec.rb b/spec/serializers/topic_view_serializer_spec.rb index ac256d27928..a1be88f7800 100644 --- a/spec/serializers/topic_view_serializer_spec.rb +++ b/spec/serializers/topic_view_serializer_spec.rb @@ -57,7 +57,7 @@ describe TopicViewSerializer do expect(json[:image_url]).to end_with(image_upload.url) end - it 'should have thumbnails' do + it 'should have thumbnail jobs enqueued' do SiteSetting.create_thumbnails = true Discourse.redis.del(topic.thumbnail_job_redis_key(Topic.thumbnail_sizes)) @@ -72,6 +72,16 @@ describe TopicViewSerializer do expect do json = serialize_topic(topic, user) end.to change { Jobs::GenerateTopicThumbnails.jobs.size }.by(0) + end + + it 'should have thumbnails after jobs run' do + Jobs.run_immediately! + SiteSetting.create_thumbnails = true + + Discourse.redis.del(topic.thumbnail_job_redis_key(Topic.thumbnail_sizes)) + json = serialize_topic(topic, user) + topic.generate_thumbnails! + json = serialize_topic(topic, user) # Original + Optimized expect(json[:thumbnails].length).to eq(2)