require_relative '../test_config' require 'hws_settings' require 'auth' class TestApp < Sinatra::Base use HWSSettings use Auth::Middleware get '/test' do 'ok' end end describe Auth::Middleware do include Rack::Test::Methods def app TestApp end it 'should allow for valid ticket authentication' do authorize 'jdoe', ticket_for_jdoe get '/test' expect(last_response.status).to eq(200) expect(last_response.body).to eq('ok') end it 'should return a 403 for invalid ticket authentication' do authorize 'jdoe', 'invalid' get '/test' expect(last_response.status).to eq(403) end end