forked from omniauth/omniauth
/
ldap_spec.rb
41 lines (34 loc) · 1.04 KB
/
ldap_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
require File.expand_path('../../../spec_helper', __FILE__)
require 'cgi'
describe OmniAuth::Strategies::LDAP, :type => :strategy do
include OmniAuth::Test::StrategyTestCase
def strategy
@ldap_server ||= 'ldap.example.org'
[OmniAuth::Strategies::LDAP, {
:host => @ldap_server,
:port => 636,
:method => :ssl,
:uid => 'jeremyf',
:base => 'o="University of OmniAuth", st=Sublime, c=RubyNation',
}]
end
describe 'GET /auth/ldap' do
before do
get '/auth/ldap'
end
# TODO: Add checks that page has authentication form; I attempted
# to use `should have_tag` but that was not working.
it 'should get authentication page' do
last_response.status.should == 200
end
end
describe 'POST /auth/ldap' do
before do
post '/auth/ldap', {:username => 'jeremy', :password => 'valid_password' }
end
it 'should redirect us to /auth/ldap/callback' do
last_response.should be_redirect
last_response.location.should == '/auth/ldap/callback'
end
end
end