Done with tests

This commit is contained in:
Wlodek Bzyl 2009-07-06 23:02:42 +02:00
parent 2981800a8b
commit 9ba77ecc34
3 changed files with 46 additions and 9 deletions

View File

@ -200,5 +200,3 @@ respectively.
2\. In order to create a virual host add the following to */etc/hosts/*:
127.0.0.1 localhost.localdomain localhost hitch.local
3\. TODO: write tests

View File

@ -19,3 +19,24 @@ get "/image_tag" do
#{image_tag("/images/foo.jpg", :alt => "[foo image]")}
EOD
end
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

View File

@ -21,7 +21,7 @@ http://example.org/bar/foo
EOD
end
def test_image_tag_returns_absolute_paths_and_full_urls
def test_image_tag_returns_sub_uri
get '/image_tag', {}, 'SCRIPT_NAME' => '/bar'
assert last_response.ok?
assert_equal last_response.body, <<EOD
@ -29,11 +29,29 @@ EOD
EOD
end
def test_stylesheet_link_tag_returns_sub_uri
get '/stylesheet_link_tag', {}, 'SCRIPT_NAME' => '/bar'
assert last_response.ok?
assert_equal last_response.body, <<EOD
<link charset="utf-8" href="/bar/stylesheets/winter.css" media="projection" rel="stylesheet" type="text/css">
<link charset="utf-8" href="/bar/stylesheets/summer.css" media="projection" rel="stylesheet" type="text/css">
EOD
end
def test_javascript_script_tag_returns_sub_uri
get '/javascript_script_tag', {}, 'SCRIPT_NAME' => '/bar'
assert last_response.ok?
assert_equal last_response.body, <<EOD
<script charset="iso-8859-2" src="/bar/javascripts/summer.js" type="text/javascript"></script>
EOD
end
def test_link_to_tag_returns_sub_uri
get '/link_to_tag', {}, 'SCRIPT_NAME' => '/bar'
assert last_response.ok?
assert_equal last_response.body, <<EOD
<a href='/bar/topr'>Tatry Mountains Rescue Team</a>
EOD
end
end
__END__
stylesheet_link_tag "/stylesheets/screen.css", "/stylesheets/summer.css", :media => "projection"
javascript_script_tag "/javascripts/jquery.js", "/javascripts/summer.js", :charset => "iso-8859-2"
link_to "Tatry Mountains Rescue Team", "/topr"