Skip to content

Commit

Permalink
Cleanup existing and (re)add a few httpdigest specs
Browse files Browse the repository at this point in the history
  • Loading branch information
clivecrous committed Oct 11, 2009
1 parent 2f62921 commit de3572b
Showing 1 changed file with 14 additions and 29 deletions.
43 changes: 14 additions & 29 deletions spec/ramaze/helper/httpdigest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ def httpdigest_lookup_password username
end
end
end
end

__END__

describe 'Digest authentication' do
behaves_like :rack_test
Expand Down Expand Up @@ -114,34 +111,22 @@ def httpdigest_lookup_password username
end
end

it 'authenticates a user with the password lookup method' do
got = get_auth( '/lookup/authenticate', 'foo', 'oof' )
got.status.should == 200
got.body.should == "Hello foo"
end

it 'fails to authenticate an incorrect password with the password lookup method' do
got = get_auth( '/lookup/authenticate', 'foo', 'bar' )
got.status.should == 401
got.body.should == "Unauthorized"
end

it 'authenticates a user with a block using auth-int' do
got = get_auth( '/authenticate', 'foo', 'oof', 'auth-int' )
got.status.should == 200
got.body.should == "Hello foo"
end
describe 'Password lookup authentication' do
behaves_like :rack_test

it 'authenticates a user with the plaintext method using auth-int' do
got = get_auth( '/plaintext/authenticate', 'foo', 'oof', 'auth-int' )
got.status.should == 200
got.body.should == "Hello foo"
end
it 'authenticates a user with the password lookup method' do
digest_authorize 'foo', 'oof'
get '/lookup/authenticate'
last_response.status.should == 200
last_response.body.should == "Hello foo"
end

it 'authenticates a user with the password lookup method using auth-int' do
got = get_auth( '/lookup/authenticate', 'foo', 'oof', 'auth-int' )
got.status.should == 200
got.body.should == "Hello foo"
it 'fails to authenticate an incorrect password with the password lookup method' do
authorize 'foo', 'bar'
get '/lookup/authenticate'
last_response.status.should == 401
last_response.body.should == "Unauthorized"
end
end

end

0 comments on commit de3572b

Please sign in to comment.