DEV: Update test case for TopicEmbed.

This commit is contained in:
Guo Xiang Tan
2018-08-24 09:41:54 +08:00
parent 1ba24496ab
commit 932195d828
2 changed files with 24 additions and 10 deletions

View File

@@ -88,11 +88,20 @@ class TopicEmbed < ActiveRecord::Base
post.reload
end
revision[:raw] = absolutize_urls(url, contents) if content_sha1 != embed.content_sha1
if content_sha1 != embed.content_sha1
revision[:raw] = absolutize_urls(url, contents)
end
revision[:title] = title if title != post.topic.title
post.revise(user, revision, skip_validations: true, bypass_rate_limiter: true) unless revision.empty?
embed.update_column(:content_sha1, content_sha1) if revision[:raw]
unless revision.empty?
post.revise(user, revision,
skip_validations: true,
bypass_rate_limiter: true
)
end
embed.update!(content_sha1: content_sha1) if revision[:raw]
end
end