1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

fix tests to work with Slim 1.0.2

This commit is contained in:
Konstantin Haase 2011-09-01 11:54:50 -06:00
parent 811cbb3c3e
commit 0db16d172f

View file

@ -52,44 +52,34 @@ class SlimTest < Test::Unit::TestCase
HTML4_DOCTYPE = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">" HTML4_DOCTYPE = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"
it "passes slim options to the slim engine" do it "passes slim options to the slim engine" do
mock_app { mock_app { get('/') { slim "x foo='bar'", :attr_wrapper => "'" }}
get '/' do
slim "doctype html\nh1 Hello World", :format => :html4
end
}
get '/' get '/'
assert ok? assert ok?
assert_equal "#{HTML4_DOCTYPE}<h1>Hello World</h1>", body assert_body "<x foo='bar'></x>"
end end
it "passes default slim options to the slim engine" do it "passes default slim options to the slim engine" do
mock_app { mock_app do
set :slim, {:format => :html4} set :slim, :attr_wrapper => "'"
get '/' do get('/') { slim "x foo='bar'" }
slim "doctype html\nh1 Hello World"
end end
}
get '/' get '/'
assert ok? assert ok?
assert_equal "#{HTML4_DOCTYPE}<h1>Hello World</h1>", body assert_body "<x foo='bar'></x>"
end end
it "merges the default slim options with the overrides and passes them to the slim engine" do it "merges the default slim options with the overrides and passes them to the slim engine" do
mock_app { mock_app do
set :slim, {:format => :html4} set :slim, :attr_wrapper => "'"
get '/' do get('/') { slim "x foo='bar'" }
slim "doctype html\nh1.header Hello World" get('/other') { slim "x foo='bar'", :attr_wrapper => '"' }
end end
get '/html5' do
slim "doctype html\nh1.header Hello World", :format => :html5
end
}
get '/' get '/'
assert ok? assert ok?
assert_match(/^#{HTML4_DOCTYPE}/, body) assert_body "<x foo='bar'></x>"
get '/html5' get '/other'
assert ok? assert ok?
assert_equal "<!DOCTYPE html><h1 class=\"header\">Hello World</h1>", body assert_body '<x foo="bar"></x>'
end end
end end