Module: SimplyAuthorized::FactoryTestHelper
- Defined in:
- lib/simply_authorized/factory_test_helper.rb
Instance Method Summary collapse
- #active_user(options = {}) ⇒ Object (also: #user)
- #admin_user(options = {}) ⇒ Object (also: #admin, #administrator)
-
#editor(options = {}) ⇒ Object
alias_method :employee, :reader.
- #interviewer(options = {}) ⇒ Object
- #reader(options = {}) ⇒ Object
- #superuser(options = {}) ⇒ Object (also: #super_user)
Instance Method Details
#active_user(options = {}) ⇒ Object Also known as: user
3 4 5 6 7 8 9 |
# File 'lib/simply_authorized/factory_test_helper.rb', line 3 def active_user(={}) u = Factory(:user, ) # leave this special save here just in case I change things. # although this would need changed for UCB CAS. # u.save_without_session_maintenance # u end |
#admin_user(options = {}) ⇒ Object Also known as: admin, administrator
19 20 21 22 23 |
# File 'lib/simply_authorized/factory_test_helper.rb', line 19 def admin_user(={}) u = active_user() u.roles << Role.find_or_create_by_name('administrator') u end |
#editor(options = {}) ⇒ Object
alias_method :employee, :reader
40 41 42 43 44 |
# File 'lib/simply_authorized/factory_test_helper.rb', line 40 def editor(={}) u = active_user() u.roles << Role.find_or_create_by_name('editor') u end |
#interviewer(options = {}) ⇒ Object
27 28 29 30 31 |
# File 'lib/simply_authorized/factory_test_helper.rb', line 27 def interviewer(={}) u = active_user() u.roles << Role.find_or_create_by_name('interviewer') u end |
#reader(options = {}) ⇒ Object
33 34 35 36 37 |
# File 'lib/simply_authorized/factory_test_helper.rb', line 33 def reader(={}) u = active_user() u.roles << Role.find_or_create_by_name('reader') u end |
#superuser(options = {}) ⇒ Object Also known as: super_user
12 13 14 15 16 |
# File 'lib/simply_authorized/factory_test_helper.rb', line 12 def superuser(={}) u = active_user() u.roles << Role.find_or_create_by_name('superuser') u end |