Sha256: e875ed99a4fb1789a23c5c3f3c22b2a8430400837a43473842cd9d1ac246f2c9

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

# encoding: UTF-8
require 'test_helper'

module Quesadilla
  class HashtagsTest < TestCase
    def test_that_it_extracts_tags
      extraction = extract('Something #tagged')
      assert_equal extraction, {
        display_text: 'Something #tagged',
        display_html: 'Something <a href="#hashtag-tagged" class="hashtag">#tagged</a>',
        entities: [
          {
            type: 'hashtag',
            text: '#tagged',
            display_text: '#tagged',
            hashtag: 'tagged',
            indices: [10, 17],
            display_indices: [10, 17]
          }
        ]
      }
    end

    def test_that_it_extracts_multiple_tags
      extraction = extract('A task with some #tags that are #awesome')
      assert_equal extraction, {
        display_text: 'A task with some #tags that are #awesome',
        display_html: 'A task with some <a href="#hashtag-tags" class="hashtag">#tags</a> that are <a href="#hashtag-awesome" class="hashtag">#awesome</a>',
        entities: [
          {
            type: 'hashtag',
            text: '#tags',
            display_text: '#tags',
            hashtag: 'tags',
            indices: [17, 22],
            display_indices: [17, 22]
          },
          {
            type: 'hashtag',
            text: '#awesome',
            display_text: '#awesome',
            hashtag: 'awesome',
            indices: [32, 40],
            display_indices: [32, 40]
          }
        ]
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quesadilla-0.1.0 test/quesadilla/hashtags_test.rb