From: http://www.sinatrarb.com/testing.html#frameworks
In app/hello_world.rb
require 'sinatra'
get '/' do
"Hello World #{params[:name]}".strip
end
In app/spec/app_spec.rb
require 'hello_world'require 'spec'
require 'rack/test'
set :environment, :test
describe 'The HelloWorldApp' do
include Rack::Test::Methods
def app
Sinatra::Application
end
it "says hello" do
get '/'
last_response.should be_ok
last_response.body.should == 'Hello World'
end
end
To execute:
$ spec spec -c






