#!/usr/bin/env ruby require File.join(File.dirname(__FILE__), "..", "spec_helper") describe "Textile Markup" do before do @textile = %{This is a _test_: * item A * item B * item C
_hello!_
Testing: # A # B # C} @html = %{

This is a test:

hello!

Testing:

  1. A
  2. B
  3. C
} end ###################################### it "should be embeddable in section macros" do text1 = %{textile[section[@title[Test] #@textile ]]} text2 = %{textile[section[@title[Test]#@textile ]]} result = %{

Test

#@html
} filter(text1).should == result filter(text2).gsub(/<\/h2>/, "").should == result end ###################################### it "should be embeddable in box macros" do result = %{
This is a test
#@html
} box1 = %{textile[box[This is a _test_|#@textile]]} box2 = %{textile[box[This is a _test_| #@textile] ]} box3 = %{textile[box[ This is a _test_| #@textile]]} box4 = %{textile[box[This is a _test_| #@textile ] ]} filter(box1).should == result filter(box2).should == result filter(box3).should == result filter(box4).should == result end ###################################### it "should be embeddable in note macros" do result = %{

Note#{@html.sub(/^

/, '')}

} note1 = %{textile[note[#@textile]]} note2 = %{textile[note[ #@textile] ]} note3 = %{textile[note[ #@textile]]} note4 = %{textile[note[ #@textile ] ]} filter(note1).should == result filter(note2).should == result filter(note3).should == result filter(note4).should == result end ###################################### it "should not interfere with the code macro" do code = %{

Test: Paragraph.

} result = %{

Test

#@html

#{code.gsub(/>/, '>').gsub(/
} text1 = %{textile[ section[@title[Test] #@textile codeblock[#{code}] ]]} text2 = %{textile[ section[@title[Test] #@textile codeblock[#{code} ] ] ]} text3 = %{textile[ section[@title[Test] #@textile codeblock[ #{code}] ]]} text4 = %{textile[ section[@title[Test] #@textile codeblock[ #{code} ]]]} text5 = %{textile[ section[@title[Test] #@textile codeblock[ #{code} ] ]]} filter(text1).should == result filter(text2).should == result filter(text3).should == result filter(text4).should == result filter(text5).should == result end end