Sha256: 53ddde30253608710e567f442d788a77242fd88c33994842d0a3e97885c19500

Contents?: true

Size: 816 Bytes

Versions: 5

Compression:

Stored size: 816 Bytes

Contents

require 'test_helper'
require 'html/pipeline/gitlab'

class HTML::Pipeline::GitlabEmojiFilterTest < Minitest::Test
  GitlabEmojiFilter = HTML::Pipeline::Gitlab::GitlabEmojiFilter

  def setup
    ActionController::Base.asset_host = 'https://foo.com'
  end

  def test_emojify
    filter = GitlabEmojiFilter.new('<p>:heart:</p>')
    doc = filter.call
    assert_match 'https://foo.com/images/emoji/heart.png', doc.search('img').attr('src').value
  end

  def test_unsupported_emoji
    block = '<p>:sheep:</p>'
    filter = GitlabEmojiFilter.new(block)
    doc = filter.call
    assert_match block, doc.to_html
  end

  def test_uri_encoding
    filter = GitlabEmojiFilter.new('<p>:+1:</p>')
    doc = filter.call
    assert_match 'https://foo.com/images/emoji/+1.png', doc.search('img').attr('src').value
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
html-pipeline-gitlab-0.2.0 test/html/pipeline/gitlab_gemoji_filter_test.rb
html-pipeline-gitlab-0.1.7 test/html/pipeline/gitlab_gemoji_filter_test.rb
html-pipeline-gitlab-0.1.6 test/html/pipeline/gitlab_gemoji_filter_test.rb
html-pipeline-gitlab-0.1.5 test/html/pipeline/gitlab_gemoji_filter_test.rb
html-pipeline-gitlab-0.1.4 test/html/pipeline/gitlab_gemoji_filter_test.rb