Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
describe how to spec rubycas with rspec.

rubycas client configuration options in config/envirement.rb
[more details] (https://github.com/rubycas/rubycas-client)

# enable detailed CAS logging
cas_logger = CASClient::Logger.new(::Rails.root+'/log/cas.log')
cas_logger.level = Logger::DEBUG

CASClient::Frameworks::Rails::Filter.configure(
  :cas_base_url  => "https://cas.example.foo/",
  :login_url     => "https://cas.example.foo/login",
  :logout_url    => "https://cas.example.foo/logout",
  :validate_url  => "https://cas.example.foo/proxyValidate",
  :username_session_key => :cas_user,
  :extra_attributes_session_key => :cas_extra_attributes,
  :logger => cas_logger,
  :enable_single_sign_out => true
)

testing description
you can set your test data for rubycas as following example

# the key `cas_user` determined by `username_session_key`   
#   session[:cas_user]  => homer
# the key `cas_extra_attributes` determined by `extra_attributes_session_key`
#   session[:cas_extra_attributes] => {:role => "user", :email => "homer@test.foo"}

# fake method argument
#   first: cas_user
#   second: cas_extra_attributes
CASClient::Frameworks::Rails::Filter.fake("homer", {:role => "user", :email => "homer@test.foo"})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.