Skip to content
Browse files

Add support for faking extra attributes

  • Loading branch information...
1 parent c492d6b commit f605a92ed6327e4acdd7dc8612e41ac2a721ef35 @soupmatt soupmatt committed with zuk Aug 21, 2010
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/casclient/frameworks/rails/filter.rb
View
8 lib/casclient/frameworks/rails/filter.rb
@@ -9,7 +9,7 @@ class Filter
@@client = nil
@@log = nil
@@fake_user = nil
-
+ @@fake_extra_attributes = nil
class << self
def filter(controller)
@@ -18,6 +18,7 @@ def filter(controller)
if @@fake_user
controller.session[client.username_session_key] = @@fake_user
controller.session[:casfilteruser] = @@fake_user
+ controller.session[client.extra_attributes_session_key] = @@fake_extra_attributes
return true
end
@@ -148,8 +149,11 @@ def configure(config)
# with cucumber and other tools.
# use like
# CASClient::Frameworks::Rails::Filter.fake("homer")
- def fake(username)
+ # you can also fake extra attributes by including a second parameter
+ # CASClient::Frameworks::Rails::Filter.fake("homer", {:roles => ['dad', 'husband']})
+ def fake(username, extra_attributes = nil)
@@fake_user = username
+ @@fake_extra_attributes = extra_attributes
end
def use_gatewaying?

0 comments on commit f605a92

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