Skip to content

Instantly share code, notes, and snippets.

@avdi
Created May 13, 2009 04:49
Show Gist options
  • Save avdi/110881 to your computer and use it in GitHub Desktop.
Save avdi/110881 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
gem 'rack', '=0.9.1'
gem 'thin', '=1.0.0'
require 'sinatra'
get '/' do
content_type 'text/plain'
"Hello, world"
end
# Run me with 'spec' executable to run my specs!
if $0 =~ /spec$/
set :environment, :test
set :run, false # Don't autostart server
require 'spec/interop/test'
require 'sinatra/test'
describe "Example App" do
include Sinatra::Test
it "should serve a greeting" do
get '/'
response.should be_ok
response.body.should == "Hello, world"
end
it "should serve content as text/plain" do
get '/'
response.headers['Content-Type'].should == 'text/plain'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment