Skip to content
Browse files

Merge pull request #340 from jeremyf/feature-add-specs

Added initial spec to LDAP strategy.
  • Loading branch information...
2 parents ef6997e + 5b2858e commit ed8fee0bfca0c2d3a210ea8953b6fb96676587b6 @sferik sferik committed
Showing with 41 additions and 0 deletions.
  1. +41 −0 oa-enterprise/spec/omniauth/strategies/ldap_spec.rb
View
41 oa-enterprise/spec/omniauth/strategies/ldap_spec.rb
@@ -0,0 +1,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

0 comments on commit ed8fee0

Please sign in to comment.
Something went wrong with that request. Please try again.