Module: Photos::FactoryTestHelper

Defined in:
lib/photos/factory_test_helper.rb

Instance Method Summary collapse

Instance Method Details

#active_user(options = {}) ⇒ Object Also known as: user



3
4
5
6
7
8
9
# File 'lib/photos/factory_test_helper.rb', line 3

def active_user(options={})
	u = Factory(:user, options)
	#	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/photos/factory_test_helper.rb', line 19

def admin_user(options={})
	u = active_user(options)
	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/photos/factory_test_helper.rb', line 40

def editor(options={})
	u = active_user(options)
	u.roles << Role.find_or_create_by_name('editor')
	u
end

#interviewer(options = {}) ⇒ Object



27
28
29
30
31
# File 'lib/photos/factory_test_helper.rb', line 27

def interviewer(options={})
	u = active_user(options)
	u.roles << Role.find_or_create_by_name('interviewer')
	u
end

#reader(options = {}) ⇒ Object



33
34
35
36
37
# File 'lib/photos/factory_test_helper.rb', line 33

def reader(options={})
	u = active_user(options)
	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/photos/factory_test_helper.rb', line 12

def superuser(options={})
	u = active_user(options)
	u.roles << Role.find_or_create_by_name('superuser')
	u
end