spec/app.rb in warden-oauthed-0.0.3 vs spec/app.rb in warden-oauthed-0.0.4
- old
+ new
@@ -1,11 +1,11 @@
require 'sinatra'
module Example
class App < Sinatra::Base
- enable :sessions
- enable :raise_errors
+ enable :sessions
+ enable :raise_errors
disable :show_exceptions
use Warden::Manager do |manager|
manager.default_strategies :oauthed
manager.failure_app = BadAuthentication
@@ -16,13 +16,11 @@
manager[:oauthed_callback_url] = '/auth/oauthed/callback'
end
helpers do
def ensure_authenticated
- unless env['warden'].authenticate!
- throw(:warden)
- end
+ throw(:warden) unless env['warden'].authenticate!
end
def user
env['warden'].user
end
@@ -43,17 +41,17 @@
redirect '/'
end
get '/logout' do
env['warden'].logout
- "Peace!"
+ 'Peace!'
end
end
class BadAuthentication < Sinatra::Base
get '/unauthenticated' do
status 403
- "Unable to authenticate, sorry bud."
+ 'Unable to authenticate, sorry bud.'
end
end
def self.app
@app ||= Rack::Builder.new do