Sha256: fd6f4ca3ec4bc526e11512fa3a32e67ded4a91a5815f0c22bc866b8fe76e374a

Contents?: true

Size: 876 Bytes

Versions: 1

Compression:

Stored size: 876 Bytes

Contents

require 'spec_helper'

describe(JekyllEmailProtect::EmailProtectionFilter) do
  let(:output) do
    doc = doc_with_content(content)
    doc.content = content
    doc.output  = Jekyll::Renderer.new(doc.site, doc).run
  end

  context "simple example address" do
    let(:email) { "example@example.com" }
    let(:content)  { "{{ '#{email}' | encode_email }}" }

    it "produces the correct percent-encoded email" do
      expect(output).to match(/%65%78%61%6D%70%6C%65@%65%78%61%6D%70%6C%65\.%63%6F%6D/)
    end
  end

  context "example address with plus and dash" do
    let(:email) { "example-person+spam@example.com" }
    let(:content)  { "{{ '#{email}' | encode_email }}" }

    it "produces the correct percent-encoded email" do
      expect(output).to match(/%65%78%61%6D%70%6C%65\-%70%65%72%73%6F%6E\+%73%70%61%6D@%65%78%61%6D%70%6C%65\.%63%6F%6D/)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jekyll-email-protect-1.0.1 spec/protect_email_filter_spec.rb