Sha256: 7118c023d509364ff6ddba7fa7a0cce9cfa81b3fdd06b0f5f75fba14a75e81c7

Contents?: true

Size: 891 Bytes

Versions: 3

Compression:

Stored size: 891 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe AutoHtml::Pipeline do
  subject { described_class.new(AutoHtml::SimpleFormat.new, AutoHtml::Image.new, AutoHtml::Link.new) }

  it 'does not transforms input when no filters provided' do
    input  = 'Hey check out my blog => http://rors.org'
    result = described_class.new.call(input)
    expect(result).to eq input
  end

  it 'transforms input using provided filters' do
    result = subject.call 'Check the logo: http://rors.org/images/rails.png. Visit: http://rubyonrails.org'
    expect(result).to eq '<p>Check the logo: <img src="http://rors.org/images/rails.png" />. Visit: <a href="http://rubyonrails.org">http://rubyonrails.org</a></p>'
  end

  it 'is blank if input is blank' do
    expect(subject.call('')).to eq ''
  end

  it 'is blank if input is nil' do
    expect(subject.call(nil)).to eq ''
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
auto_html-2.1.1 spec/auto_html/pipeline_spec.rb
auto_html-2.1.0 spec/auto_html/pipeline_spec.rb
auto_html-2.0.2 spec/auto_html/pipeline_spec.rb