sinatra-static-assets/test/sinatra_app.rb

46 lines
898 B
Ruby
Raw Normal View History

2009-07-06 21:41:47 +00:00
path = File.expand_path("../lib" + File.dirname(__FILE__))
$:.unshift(path) unless $:.include?(path)
2009-07-05 16:00:34 +00:00
require 'rubygems'
require 'sinatra'
require 'sinatra/url_for'
2009-07-05 16:28:12 +00:00
require 'sinatra/static_assets'
2009-07-05 16:00:34 +00:00
2009-07-05 16:28:12 +00:00
get "/url_for" do
2009-07-05 16:00:34 +00:00
content_type "text/plain"
<<"EOD"
#{url_for("/")}
#{url_for("/foo")}
#{url_for("/foo", :full)}
EOD
end
2009-07-05 16:28:12 +00:00
get "/image_tag" do
content_type "text/plain"
<<"EOD"
#{image_tag("/images/foo.jpg", :alt => "[foo image]")}
EOD
end
2009-07-06 21:02:42 +00:00
get "/stylesheet_link_tag" do
content_type "text/plain"
<<"EOD"
#{stylesheet_link_tag("/stylesheets/winter.css", "/stylesheets/summer.css", :media => "projection")}
EOD
end
get "/javascript_script_tag" do
content_type "text/plain"
<<"EOD"
#{javascript_script_tag "/javascripts/summer.js", :charset => "iso-8859-2"}
EOD
end
get "/link_to_tag" do
content_type "text/plain"
<<"EOD"
#{link_to "Tatry Mountains Rescue Team", "/topr"}
EOD
end