Sha256: 626d3804eba3eff4ec4ce79cc4e9884776d42545ef19ec0f68524241cdef936c

Contents?: true

Size: 566 Bytes

Versions: 4

Compression:

Stored size: 566 Bytes

Contents

require 'sinatra'

#
# Simple Sinatra application for testing
#
class SinatraApp < Sinatra::Base
  enable :sessions

  get '/login' do
    body 'Please log in'
  end

  post '/login' do
    session[:user_email] = params[:user_email]
    redirect to('/profile')
  end

  get '/profile' do
    if user_email == session[:user_email]
      body "Welcome, #{user_email}!"
    else
      redirect to('/login')
    end
  end
end

# configure sinatra application
SinatraApp.configure do |app|
#  app.use MyRackMiddleware
end

defined?(Capybara) && Capybara.app = SinatraApp

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wrap_it-1.0.2 spec/frameworks/sinatra_app.rb
wrap_it-1.0.1 spec/frameworks/sinatra_app.rb
wrap_it-1.0.0 spec/frameworks/sinatra_app.rb
wrap_it-0.2.0 spec/frameworks/sinatra_app.rb