Fix failing specs.

This commit is contained in:
Guo Xiang Tan 2017-03-14 14:58:22 +08:00
parent d173473509
commit 6312b8b7e4
2 changed files with 5 additions and 2 deletions

View File

@ -432,6 +432,8 @@ HTML
describe "custom emoji" do
it "replaces the custom emoji" do
CustomEmoji.create!(name: 'trout', upload: Fabricate(:upload))
Emoji.clear_cache
expect(PrettyText.cook("hello :trout:")).to match(/<img src[^>]+trout[^>]+>/)
end
end

View File

@ -2,12 +2,13 @@ require 'rails_helper'
RSpec.describe Jobs::RebakeCustomEmojiPosts do
it 'should rebake posts that are using a given custom emoji' do
custom_emoji = CustomEmoji.create!(name: 'test', upload: Fabricate(:upload))
upload = Fabricate(:upload)
custom_emoji = CustomEmoji.create!(name: 'test', upload: upload)
Emoji.clear_cache
post = Fabricate(:post, raw: 'some post with :test: yay')
expect(post.reload.cooked).to eq(
"<p>some post with <img src=\"/uploads/default/0/1234567890123456.png?v=3\" title=\":test:\" class=\"emoji emoji-custom\" alt=\":test:\"> yay</p>"
"<p>some post with <img src=\"#{upload.url}?v=3\" title=\":test:\" class=\"emoji emoji-custom\" alt=\":test:\"> yay</p>"
)
custom_emoji.destroy!