Skip to content

Instantly share code, notes, and snippets.

@bhuga
Created April 2, 2010 16:19
Show Gist options
  • Save bhuga/353324 to your computer and use it in GitHub Desktop.
Save bhuga/353324 to your computer and use it in GitHub Desktop.
# sample heroku rackup
http://rdfdo.heroku.com/postgres
http://rdfdo.heroku.com/sqlite3
$:.unshift(Dir.glob("./.bundle/gems/bundler/gems/rdf-spec*gemspec*/lib").first)
require 'spec'
app = proc do |env|
io = StringIO.new
basename = File.basename(env['REQUEST_PATH'])
if basename.empty?
files = Dir.glob(File.dirname(__FILE__) + '/spec/*.spec')
else
files = ['spec/' + basename + ".spec"] unless basename =~ /spec$/
end
options = ['--format','html',files].flatten
puts "I couldn't find #{options.last}" unless File.exists?(options.last)
parser = ::Spec::Runner::OptionParser.new(io, io)
parser.order!(options)
opts = parser.options
::Spec::Runner.use opts
opts.run_examples
[ 200, {'Content-Type' => 'text/html'}, io.string ]
end
run app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment