Sha256: 8ddf7c7fead0ff076b0c24429eadf5227b13c09537e9a781f64d627e0ac87f8a

Contents?: true

Size: 857 Bytes

Versions: 1

Compression:

Stored size: 857 Bytes

Contents

require 'rails_helper'

class Devise::SessionsController < ActionController::Base

end

require_relative '../../../app/controllers/devise/saml_sessions_controller'


describe Devise::SamlSessionsController, type: :controller do
  let(:saml_config) { Devise.saml_config }

  describe '#new' do
    it 'redirects to the SAML Auth Request endpoint' do
      get :new
      expect(response).to redirect_to(%r(\Ahttp://localhost:8009/saml/auth\?SAMLRequest=))
    end
  end

  describe '#metadata' do
    it "generates metadata" do
      get :metadata

      # Remove ID that can vary across requests
      expected_metadata = OneLogin::RubySaml::Metadata.new.generate(saml_config)
      metadata_pattern = Regexp.escape(expected_metadata).gsub(/ ID='[^']+'/, " ID='[\\w-]+'")
      expect(response.body).to match(Regexp.new(metadata_pattern))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
devise_saml_authenticatable-0.1.0 spec/controllers/devise/saml_sessions_controller_spec.rb