summaryrefslogtreecommitdiff
path: root/spec/routing/routing_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/routing/routing_spec.rb')
-rw-r--r--spec/routing/routing_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/routing/routing_spec.rb b/spec/routing/routing_spec.rb
index e8333232b90..6f67cdb1222 100644
--- a/spec/routing/routing_spec.rb
+++ b/spec/routing/routing_spec.rb
@@ -277,6 +277,33 @@ describe "Authentication", "routing" do
it "PUT /users/password" do
expect(put("/users/password")).to route_to('passwords#update')
end
+
+ context 'with LDAP configured' do
+ include LdapHelpers
+
+ let(:ldap_settings) { { enabled: true } }
+
+ before do
+ stub_ldap_setting(ldap_settings)
+ Rails.application.reload_routes!
+ end
+
+ after(:all) do
+ Rails.application.reload_routes!
+ end
+
+ it 'POST /users/auth/ldapmain/callback' do
+ expect(post("/users/auth/ldapmain/callback")).to route_to('ldap/omniauth_callbacks#ldapmain')
+ end
+
+ context 'with LDAP sign-in disabled' do
+ let(:ldap_settings) { { enabled: true, prevent_ldap_sign_in: true } }
+
+ it 'prevents POST /users/auth/ldapmain/callback' do
+ expect(post("/users/auth/ldapmain/callback")).not_to be_routable
+ end
+ end
+ end
end
describe HealthCheckController, 'routing' do