Sha256: a7ab1df3e39e19a531e609c82915f369713312cc64380492716137f039c5dbbf

Contents?: true

Size: 914 Bytes

Versions: 1

Compression:

Stored size: 914 Bytes

Contents

require "test_helper"

EmailReplyFilter = HTML::Pipeline::EmailReplyFilter

class HTML::Pipeline::EmailReplyFilterTest < Minitest::Test
  def setup
    @body = <<-EMAIL
Hey, don't send email addresses in comments. They aren't filtered.

> On Mar 5, 2016, at 08:05, Boaty McBoatface <boatymcboatface@example.com> wrote:
>
> Sup. alreadyleaked@example.com
>
> —
> Reply to this email directly or view it on GitHub.
EMAIL
  end

  def test_doesnt_hide_by_default
    filter = EmailReplyFilter.new(@body)
    doc = filter.call.to_s
    assert_match %r(alreadyleaked@example.com), doc
    assert_match %r(boatymcboatface@example.com), doc
  end

  def test_hides_email_addresses_when_configured
    filter = EmailReplyFilter.new(@body, :hide_quoted_email_addresses => true)
    doc = filter.call.to_s
    refute_match %r(boatymcboatface@example.com), doc
    refute_match %r(alreadyleaked@example.com), doc
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
html-pipeline-2.4.0 test/html/pipeline/email_reply_filter_test.rb