blob: 3ead1e1cc40c88aac8add6ea582d60bed0d16743 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
Factory.sequence :recruit do |n|
"recruit-#{n}"
end
Factory.sequence :mentor do |n|
"mentor-#{n}"
end
Factory.sequence :recruiter do |n|
"recruiter-#{n}"
end
Factory.sequence :administrator do |n|
"administrator-#{n}"
end
# Creates a new mentor for recruit by default
Factory.define :recruit, :class => User do |u|
u.name { Factory.next(:recruit) }
u.email_address { |u| "#{u.name}@recruits.org" }
u.mentor { Factory(:mentor) }
end
Factory.define :mentor, :class => User do |u|
u.name { Factory.next(:mentor) }
u.email_address { |u| "#{u.name}@recruiters.org" }
u.role :mentor
u.nick { |u| u.name }
end
Factory.define :recruiter, :class => User do |u|
u.name { Factory.next(:recruiter) }
u.email_address { |u| "#{u.name}@recruiters.org" }
u.role :recruiter
u.nick { |u| u.name }
end
Factory.define :administrator, :class => User do |u|
u.name { Factory.next(:administrator) }
u.email_address { |u| "#{u.name}@admins.org" }
u.role :recruiter
u.administrator true
u.nick { |u| u.name }
end
Factory.sequence :category do |n|
"category-#{n}"
end
Factory.define :category do |q|
q.name { Factory.next(:category) }
end
Factory.define :question_category do |qc|
qc.association :question
qc.association :category
end
Factory.sequence :question do |n|
"question-#{n}"
end
# it'll belong to new category by default
Factory.define :question do |q|
q.title { Factory.next(:question) }
q.after_build { |q|
q.categories = [Factory.build :category]
}
end
Factory.sequence :answer do |n|
"answer-#{n}"
end
# It'll be answer of new recruit for a new question by default
Factory.define :answer do |a|
a.content { Factory.next(:answer) }
a.question { Factory(:question)}
a.owner { Factory(:recruit)}
end
# It'll be answer of new recruit for a new question by default
Factory.define :multiple_choice_answer do |a|
a.content { Factory.next(:answer) }
a.question { Factory(:question)}
a.owner { Factory(:recruit)}
end
Factory.define :user_category do |q|
q.user { Factory(:recruit) }
q.category { Factory(:category) }
end
Factory.sequence :comment do |n|
"comment-#{n}"
end
Factory.define :comment do |c|
c.answer { Factory(:answer) }
c.owner { |c| c.answer.owner.mentor }
c.content { Factory.next(:comment) }
end
# create new recruit (being accepted) and mentor (accepting) by default
Factory.define :project_acceptance do |a|
a.user { Factory(:recruit) }
a.accepting_nick { Factory(:mentor).nick }
end
Factory.sequence :question_group do |n|
"question_group-#{n}"
end
Factory.define :question_group do |c|
c.name { Factory.next(:question_group) }
c.description "Just another group"
end
Factory.define :user_question_group do |c|
c.user { Factory(:user) }
c.question { Factory(:question, :question_group => Factory(:question_group)) }
end
Factory.define :question_content_text do |q|
q.content "fake"
end
Factory.define :question_content_multiple_choice do |q|
q.content "fake"
end
Factory.define :question_content_email do |q|
q.question {Factory(:question)}
end
Factory.define :option do |o|
o.content "fake"
end
Factory.define :guest do |g|; end
|