spec/grape/middleware/auth/digest_spec.rb in grape-0.6.0 vs spec/grape/middleware/auth/digest_spec.rb in grape-0.6.1
- old
+ new
@@ -7,28 +7,28 @@
actual_response.body.empty?
end
end
class Test < Grape::API
- http_digest({:realm => 'Test Api', :opaque => 'secret'}) do |username|
- {'foo' => 'bar'}[username]
+ http_digest(realm: 'Test Api', opaque: 'secret') do |username|
+ { 'foo' => 'bar' }[username]
end
get '/test' do
- [{:hey => 'you'},{:there => 'bar'},{:foo => 'baz'}]
+ [{ hey: 'you' }, { there: 'bar' }, { foo: 'baz' }]
end
end
describe Grape::Middleware::Auth::Digest do
def app
Test
end
-
+
it 'is a digest authentication challenge' do
get '/test'
last_response.should be_challenge
end
-
+
it 'throws a 401 if no auth is given' do
get '/test'
last_response.status.should == 401
end