asdfsdf

Javascript code posted
created at 21 Nov 20:00, updated at 28 Jan 06:16

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
describe Textilizer do
  def textilize(text)
    Textilizer.new(text).to_html
  end
  
  it "should do basic textile" do
    textilize("hello *world*").should == "<p>hello <strong>world</strong></p>"
  end
  
  it "should wrap @@@ in a code block" do
    textilize("@@@\nfoo\n@@@").strip.should == CodeRay.scan('foo', nil).div(:css => :class).strip
  end
  
  it "should not process textile in code block" do
    textilize("@@@\nfoo *bar*\n@@@").strip.should == CodeRay.scan('foo *bar*', nil).div(:css => :class).strip
  end
  
  it "allow language for code block" do
    textilize("@@@ ruby\n@foo\n@@@").strip.should == CodeRay.scan('@foo', 'ruby').div(:css => :class).strip
  end
  
  it "allow code block in the middle" do
    textilize("foo\n@@@\ntest\n@@@\nbar").should include(CodeRay.scan('test', 'ruby').div(:css => :class).strip)
  end
  
  it "should handle \r in code block" do
    textilize("\r\n@@@\r\nfoo\r\n@@@\r\n").strip.should == CodeRay.scan('foo', nil).div(:css => :class).strip
  end
end
1.01 KB in 3 ms with coderay