Sha256: fbd19dcf4003db39a1e74143fc6d18f19e6fac6c75d50ec1cc686507aa081943

Contents?: true

Size: 994 Bytes

Versions: 2

Compression:

Stored size: 994 Bytes

Contents

require 'sinatra/base'
require 'rack'

class TestApp < Sinatra::Base
  set :root, File.dirname(__FILE__)
  set :static, true

  get '/' do
    'Hello world!'
  end

  get '/foo' do
    'Another World'
  end

  get '/with_html' do
    erb :with_html
  end

  get '/with_js' do
    erb :with_js
  end

  get '/with_simple_html' do
    erb :with_simple_html
  end

  get '/with_scope' do
    erb :with_scope
  end

  get '/form' do
    erb :form
  end

  post '/redirect' do
    redirect '/redirect_again'
  end

  get '/redirect' do
    redirect '/redirect_again'
  end

  get '/redirect_again' do
    redirect '/landed'
  end

  get '/landed' do
    "You landed"
  end

  post '/form' do
    '<pre id="results">' + params[:form].to_yaml + '</pre>'
  end
  
  get '/form/get' do
    '<pre id="results">' + params[:form].to_yaml + '</pre>'
  end

  post '/upload' do
    params[:form][:document][:tempfile].read
  end
end

if __FILE__ == $0
  Rack::Handler::Mongrel.run TestApp, :Port => 8070
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capybara-0.1.1 spec/test_app.rb
capybara-0.1 spec/test_app.rb