Skip to content

Commit

Permalink
Add a test files listing
Browse files Browse the repository at this point in the history
  • Loading branch information
fiann committed Jun 1, 2010
1 parent 0e23666 commit a8b3178
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 26 deletions.
12 changes: 10 additions & 2 deletions lib/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,17 @@ def logger
end
get '/test/*' do
file = params[:splat].join '/'
file = 'index.html' if file.empty?

if file =~ /\.html$/
if file.empty?
@listing = ""
Dir.new("#{settings.root}/test/").each do | filename |
next unless filename =~ /\.html$/
@listing << <<-TEXT
<li><a href="/test/#{filename}">#{filename}</a></li>
TEXT
end
haml :"tests.html"
elsif file =~ /\.html$/
content = File.read("#{settings.root}/test/#{file}")
@filename = /^(.+)\.html$/.match(file)[1]
@title = /<title>(.+)<\/title>/.match(content)[1] || "Open Graph Protocol test page"
Expand Down
20 changes: 20 additions & 0 deletions site/tests.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
!!! 5
%html
%head
%title OGP Parser Test Suite
%link(rel="stylesheet" href="/qunit/qunit/qunit.css" type="text/css" media="screen")
%link(rel="stylesheet" href="/tests.css" type="text/css" media="screen")

%body
%h1#qunit-header Open Graph Protocol Test Suite
%h2#qunit-banner
%div#qunit-testrunner-toolbar
%h2#qunit-userAgent

/ HTML content
%div.examples
%p Test pages:
%ul
= @listing

%p.footer &nbsp;
24 changes: 0 additions & 24 deletions test/index.html

This file was deleted.

0 comments on commit a8b3178

Please sign in to comment.