Sha256: 806d3275891bb6515e82e0416829666cce023f8c12713eb245f046e42f7ee931

Contents?: true

Size: 801 Bytes

Versions: 2

Compression:

Stored size: 801 Bytes

Contents

require 'text_utils/spec_helper'

describe "FormatQualifier" do
  before do
    @processor = TextUtils::FormatQualifier.new
  end

  it_should_behave_like 'text processor'

  it "should qualify format" do
    [
      '<b>some</b>',                 :html,
      '<b>some</b> <p>other</p>',    :html,
      ' <b> some</b> ',              :html,
      '<b/>',                        :html,
      '<b>',                         :markdown,
      'abc',                         :markdown
    ].each_slice 2 do |text, format|
      env = {}
      @processor.call(text, env)
      env[:format].should == format
    end
  end

  it "should qualify :html (from error)" do
    html = <<HTML
<h2>Title</h2>

<p>body</p>
HTML

    env = {}
    @processor.call(html, env)
    env[:format].should == :html
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rad_kit-0.0.10 spec/text_utils/format_qualifier_spec.rb
rad_kit-0.0.9 spec/text_utils/format_qualifier_spec.rb