spec/spec_lesstile.rb in lesstile-0.3.0 vs spec/spec_lesstile.rb in lesstile-1.0.0
- old
+ new
@@ -1,20 +1,10 @@
require 'rubygems'
require 'spec'
require File.dirname(__FILE__) + '/../lib/lesstile'
-describe "Lesstile#format_as_xhtml" do
- before(:all) do
- @lesstile = Lesstile
- @format = lambda {|text|
- @lesstile.format_as_xhtml(text,
- :code_formatter => lambda {|code, lang| "|#{"(#{lang})" if lang}#{code}|" },
- :text_formatter => lambda {|text| text }
- )
- }
- end
-
+describe 'an html formatter', :shared => true do
it "normal text unchanged" do
@format["hello"].should == "hello"
end
it "does not modify the input parameter" do
@@ -59,9 +49,37 @@
end
it 'escapes quotes' do
@format['"'].should == """
end
+end
+
+describe "Lesstile#format_as_xhtml" do
+ before(:all) do
+ @lesstile = Lesstile
+ @format = lambda {|text|
+ @lesstile.format_as_xhtml(text,
+ :code_formatter => lambda {|code, lang| "|#{"(#{lang})" if lang}#{code}|" },
+ :text_formatter => lambda {|text| text }
+ )
+ }
+ end
+
+ it_should_behave_like 'an html formatter'
+end
+
+describe "Lesstile#format_as_html" do
+ before(:all) do
+ @lesstile = Lesstile
+ @format = lambda {|text|
+ @lesstile.format_as_html(text,
+ :code_formatter => lambda {|code, lang| "|#{"(#{lang})" if lang}#{code}|" },
+ :text_formatter => lambda {|text| text }
+ )
+ }
+ end
+
+ it_should_behave_like 'an html formatter'
end
describe 'Lesstile default text formatter' do
before(:all) do
@format = lambda {|text| Lesstile.default_options[:text_formatter][text] }