I have a digest auth set up like the example from the sinatrarb website.
#config.ru
require './main'
app = Rack::Auth::Digest::MD5.new(Sinatra::Application) do |username|
{'foo' => 'bar'}[username]
end
app.realm = 'Protected Area'
app.opaque = 'secretkey'
run app
I was wondering if anyone knows how or can point me to a guide rspecing this.
Thanks.
The Sinatra FAQ has an example using Test::Unit and Basic Auth. I’ve never used RSpec with Sinatra but it should be easy to translate the example from Test::Unit.
Even though the example use Basic Auth, Digest Auth can be tested the same way. The only difference is you need to use Rack::Test’s digest_authorize method instead. For example, the last test in the FAQ would become this: