sambal-cle 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +7 -0
- data/Gemfile.lock +44 -0
- data/lib/sambal-cle/data_objects/announcement.rb +7 -7
- data/lib/sambal-cle/data_objects/assessment.rb +26 -77
- data/lib/sambal-cle/data_objects/assessment_submission.rb +26 -0
- data/lib/sambal-cle/data_objects/assignment.rb +40 -40
- data/lib/sambal-cle/data_objects/assignment_permissions.rb +4 -4
- data/lib/sambal-cle/data_objects/assignment_submission.rb +4 -4
- data/lib/sambal-cle/data_objects/blog.rb +2 -2
- data/lib/sambal-cle/data_objects/blogger.rb +3 -3
- data/lib/sambal-cle/data_objects/chat_room.rb +2 -2
- data/lib/sambal-cle/data_objects/{site.rb → course.rb} +24 -20
- data/lib/sambal-cle/data_objects/event.rb +4 -4
- data/lib/sambal-cle/data_objects/forum.rb +21 -22
- data/lib/sambal-cle/data_objects/glossary_term.rb +71 -0
- data/lib/sambal-cle/data_objects/lesson.rb +10 -9
- data/lib/sambal-cle/data_objects/matrix.rb +142 -0
- data/lib/sambal-cle/data_objects/message.rb +2 -2
- data/lib/sambal-cle/data_objects/poll.rb +2 -2
- data/lib/sambal-cle/data_objects/portfolio.rb +120 -0
- data/lib/sambal-cle/data_objects/questions.rb +690 -0
- data/lib/sambal-cle/data_objects/resource.rb +12 -12
- data/lib/sambal-cle/data_objects/syllabus.rb +7 -7
- data/lib/sambal-cle/data_objects/web_content_tool.rb +2 -2
- data/lib/sambal-cle/data_objects/wiki.rb +6 -6
- data/lib/sambal-cle/page_objects/assessments.rb +165 -157
- data/lib/sambal-cle/page_objects/assignments.rb +17 -17
- data/lib/sambal-cle/page_objects/glossary.rb +14 -64
- data/lib/sambal-cle/page_objects/matrix.rb +77 -113
- data/lib/sambal-cle/page_objects/portfolios.rb +0 -2
- data/lib/sambal-cle/page_objects/resources.rb +4 -4
- data/lib/sambal-cle/page_objects/site_setup.rb +31 -23
- data/lib/sambal-cle/page_objects/sites.rb +2 -12
- data/lib/sambal-cle/utilities.rb +0 -6
- data/lib/sambal-cle/workflows.rb +77 -76
- data/lib/sambal-cle.rb +2 -2
- data/sambal-cle.gemspec +2 -2
- data/test/add_assignment_to_calendar_spec.rb +4 -4
- data/test/assessment_create_spec.rb +1 -1
- data/test/assessment_feedback_spec.rb +78 -0
- data/test/assessment_publish_spec.rb +102 -0
- data/test/assignment_announcements_spec.rb +4 -4
- data/test/assignment_duplicate_spec.rb +4 -4
- data/test/assignment_gradebook_spec.rb +4 -4
- data/test/assignment_permissions_spec.rb +5 -5
- data/test/assignments_grading_spec.rb +4 -4
- data/test/assignments_submission_spec.rb +4 -4
- data/test/duplicate_site_spec.rb +2 -2
- data/test/glossary_term_create_spec.rb +71 -0
- data/test/import_site_content_spec.rb +3 -3
- data/test/test_spec.rb +51 -0
- metadata +16 -5
@@ -0,0 +1,690 @@
|
|
1
|
+
class MultipleChoiceQuestion
|
2
|
+
|
3
|
+
include Foundry
|
4
|
+
include DataFactory
|
5
|
+
include Workflows
|
6
|
+
include StringFactory
|
7
|
+
|
8
|
+
attr_accessor :assessment, :text, :point_value, :part, :correct_type, :answer_credit,
|
9
|
+
:negative_point_value, :pool,
|
10
|
+
# TODO: There is no support yet for situations with multiple correct answers
|
11
|
+
:correct_answer,
|
12
|
+
# TODO: Can't have questions with more than 26 answers. That support must be added if necessary
|
13
|
+
:answers,
|
14
|
+
:answers_feedback,
|
15
|
+
:randomize_answers, :require_rationale, :correct_answer_feedback,
|
16
|
+
:incorrect_answer_feedback
|
17
|
+
|
18
|
+
|
19
|
+
def initialize(browser, opts={})
|
20
|
+
@browser = browser
|
21
|
+
defaults = {
|
22
|
+
:text=>random_alphanums,
|
23
|
+
:point_value=>(rand(100)+1).to_s,
|
24
|
+
:correct_type=>:single_correct,
|
25
|
+
:answers=>[random_alphanums, random_alphanums, random_alphanums, random_alphanums],
|
26
|
+
}
|
27
|
+
defaults[:correct_answer]=(rand(defaults[:answers].length)+65).chr.to_s
|
28
|
+
options = defaults.merge(opts)
|
29
|
+
set_options(options)
|
30
|
+
requires @assessment, @part
|
31
|
+
end
|
32
|
+
|
33
|
+
def create
|
34
|
+
# Note that this method presumes that it's being called from
|
35
|
+
# within methods in the AssessmentObject class, not directly
|
36
|
+
# in a test script, so no positioning navigation is set up.
|
37
|
+
on EditAssessment do |edit|
|
38
|
+
edit.question_type "Multiple Choice"
|
39
|
+
end
|
40
|
+
on MultipleChoice do |add|
|
41
|
+
add.answer_point_value.set @point_value
|
42
|
+
add.question_text.set @text
|
43
|
+
add.send(@correct_type).set
|
44
|
+
add.send(@answer_credit).set unless @answer_credit==nil
|
45
|
+
add.negative_point_value.fit @negative_point_value
|
46
|
+
case(@answers.length)
|
47
|
+
when 1..3
|
48
|
+
(4-@answers.length).times { add.remove_last_answer }
|
49
|
+
when 4
|
50
|
+
# Do nothing yet
|
51
|
+
when 5..10
|
52
|
+
add.insert_additional_answers.select((@answers.length-4).to_s)
|
53
|
+
when 11..16
|
54
|
+
add.insert_additional_answers.select "6"
|
55
|
+
add.insert_additional_answers.select((@answers.length-10).to_s)
|
56
|
+
when 17..22
|
57
|
+
2.times {add.insert_additional_answers.select "6"}
|
58
|
+
add.insert_additional_answers.select((@answers.length-16).to_s)
|
59
|
+
when 23..26
|
60
|
+
3.times {add.insert_additional_answers.select "6"}
|
61
|
+
add.insert_additional_answers.select((@answers.length-22).to_s)
|
62
|
+
else
|
63
|
+
raise "There is no support for more than 26 choices right now"
|
64
|
+
end
|
65
|
+
@answers.each_with_index do |answer, x|
|
66
|
+
add.answer_text((x+65).chr).set answer
|
67
|
+
end
|
68
|
+
@answers_feedback.each_with_index do |feedback, x|
|
69
|
+
add.answer_feedback_text((x+65).chr).set feedback
|
70
|
+
end
|
71
|
+
add.correct_answer(@correct_answer).set
|
72
|
+
add.randomize_answers_yes.set if @randomize_answers=="yes"
|
73
|
+
add.require_rationale_yes.set if @require_rationale=="yes"
|
74
|
+
add.assign_to_part.select /#{@part}/
|
75
|
+
add.assign_to_pool.fit @pool
|
76
|
+
add.correct_answer_feedback.fit @correct_answer_feedback
|
77
|
+
add.incorrect_answer_feedback.fit @incorrect_answer_feedback
|
78
|
+
add.save
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def edit opts={}
|
83
|
+
# TODO
|
84
|
+
set_options(opts)
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
class SurveyQuestion
|
90
|
+
|
91
|
+
include Foundry
|
92
|
+
include DataFactory
|
93
|
+
include Workflows
|
94
|
+
include StringFactory
|
95
|
+
|
96
|
+
attr_accessor :assessment, :text, :part, :answer, :feedback, :pool
|
97
|
+
|
98
|
+
ANSWERS=[
|
99
|
+
:yes_no,
|
100
|
+
:disagree_agree,
|
101
|
+
:disagree_undecided,
|
102
|
+
:below_above,
|
103
|
+
:strongly_agree,
|
104
|
+
:unacceptable_excellent,
|
105
|
+
:one_to_five,
|
106
|
+
:one_to_ten
|
107
|
+
]
|
108
|
+
|
109
|
+
def initialize(browser, opts={})
|
110
|
+
@browser = browser
|
111
|
+
|
112
|
+
defaults = {
|
113
|
+
:text=>random_alphanums,
|
114
|
+
:answer=>ANSWERS[rand(ANSWERS.length)]
|
115
|
+
}
|
116
|
+
options = defaults.merge(opts)
|
117
|
+
|
118
|
+
set_options(options)
|
119
|
+
requires @assessment
|
120
|
+
end
|
121
|
+
|
122
|
+
def create
|
123
|
+
# Note that this method presumes that it's being called from
|
124
|
+
# within methods in the AssessmentObject class, not directly
|
125
|
+
# in a test script, so no positioning navigation is set up.
|
126
|
+
on EditAssessment do |edit|
|
127
|
+
edit.question_type "Survey"
|
128
|
+
end
|
129
|
+
on Survey do |add|
|
130
|
+
add.question_text.set @text
|
131
|
+
add.send(@answer).set
|
132
|
+
add.assign_to_part.select /#{@part}/
|
133
|
+
add.assign_to_pool.fit @pool
|
134
|
+
add.feedback.fit @feedback
|
135
|
+
add.save
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def edit opts={}
|
140
|
+
#TODO
|
141
|
+
set_options(opts)
|
142
|
+
end
|
143
|
+
|
144
|
+
|
145
|
+
end
|
146
|
+
|
147
|
+
class ShortAnswerQuestion
|
148
|
+
|
149
|
+
include Foundry
|
150
|
+
include DataFactory
|
151
|
+
include Workflows
|
152
|
+
include StringFactory
|
153
|
+
|
154
|
+
attr_accessor :assessment, :part, :text, :point_value, :model_answer, :feedback, :pool
|
155
|
+
|
156
|
+
def initialize(browser, opts={})
|
157
|
+
@browser = browser
|
158
|
+
|
159
|
+
defaults = {
|
160
|
+
:text=>random_alphanums,
|
161
|
+
:point_value=>(rand(100)+1).to_s,
|
162
|
+
:model_answer=>random_alphanums,
|
163
|
+
}
|
164
|
+
options = defaults.merge(opts)
|
165
|
+
|
166
|
+
set_options(options)
|
167
|
+
requires @assessment, @part
|
168
|
+
end
|
169
|
+
|
170
|
+
def create
|
171
|
+
# Note that this method presumes that it's being called from
|
172
|
+
# within methods in the AssessmentObject class, not directly
|
173
|
+
# in a test script, so no positioning navigation is set up.
|
174
|
+
on EditAssessment do |edit|
|
175
|
+
edit.question_type "Short Answer/Essay"
|
176
|
+
end
|
177
|
+
on ShortAnswer do |add|
|
178
|
+
add.question_text.set @text
|
179
|
+
add.answer_point_value.set @point_value
|
180
|
+
add.model_short_answer.set @model_answer
|
181
|
+
add.feedback.fit @feedback
|
182
|
+
add.assign_to_part.select /#{@part}/
|
183
|
+
add.assign_to_pool.fit @pool
|
184
|
+
add.save
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
def edit opts={}
|
189
|
+
#TODO
|
190
|
+
end
|
191
|
+
|
192
|
+
end
|
193
|
+
|
194
|
+
class FillInBlankQuestion
|
195
|
+
|
196
|
+
include Foundry
|
197
|
+
include DataFactory
|
198
|
+
include StringFactory
|
199
|
+
include Workflows
|
200
|
+
|
201
|
+
attr_accessor :assessment, :part, :text, :point_value, :case_sensitive, :mutually_exclusive, :pool,
|
202
|
+
:correct_answer_feedback, :incorrect_answer_feedback,
|
203
|
+
# TODO: Make the answer support more robust--for synonyms and stuff.
|
204
|
+
:answers
|
205
|
+
|
206
|
+
def initialize(browser, opts={})
|
207
|
+
@browser = browser
|
208
|
+
|
209
|
+
defaults = {
|
210
|
+
:answers=>[random_alphanums, random_alphanums],
|
211
|
+
:point_value=>(rand(100)+1).to_s
|
212
|
+
}
|
213
|
+
question_string = random_alphanums
|
214
|
+
defaults[:answers].each do |answer|
|
215
|
+
question_string << " {#{answer}} #{random_alphanums}"
|
216
|
+
end
|
217
|
+
defaults[:text]=question_string
|
218
|
+
options = defaults.merge(opts)
|
219
|
+
|
220
|
+
set_options(options)
|
221
|
+
requires @assessment
|
222
|
+
end
|
223
|
+
|
224
|
+
def create
|
225
|
+
# Note that this method presumes that it's being called from
|
226
|
+
# within methods in the AssessmentObject class, not directly
|
227
|
+
# in a test script, so no positioning navigation is set up.
|
228
|
+
on EditAssessment do |edit|
|
229
|
+
edit.question_type "Fill in the Blank"
|
230
|
+
end
|
231
|
+
on FillInBlank do |add|
|
232
|
+
add.question_text.set @text
|
233
|
+
add.answer_point_value.set @point_value
|
234
|
+
add.case_sensitive.send(@case_sensitive) unless @case_sensitive==nil
|
235
|
+
add.mutually_exclusive.send(@mutually_exclusive) unless @mutually_exclusive==nil
|
236
|
+
add.feedback.fit @feedback
|
237
|
+
add.assign_to_part.select /#{@part}/
|
238
|
+
add.assign_to_pool.fit @pool
|
239
|
+
add.save
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
def edit opts={}
|
244
|
+
|
245
|
+
set_options(opts)
|
246
|
+
end
|
247
|
+
|
248
|
+
end
|
249
|
+
|
250
|
+
class NumericResponseQuestion
|
251
|
+
|
252
|
+
include Foundry
|
253
|
+
include DataFactory
|
254
|
+
include StringFactory
|
255
|
+
include Workflows
|
256
|
+
|
257
|
+
attr_accessor :text, :point_value, :answers, :correct_answer_feedback, :part, :pool, :incorrect_answer_feedback
|
258
|
+
|
259
|
+
def initialize(browser, opts={})
|
260
|
+
@browser = browser
|
261
|
+
|
262
|
+
defaults = {
|
263
|
+
:answers=>[rand(2000), rand(10000000)],
|
264
|
+
:point_value=>(rand(100)+1).to_s
|
265
|
+
}
|
266
|
+
question_string = random_alphanums
|
267
|
+
defaults[:answers].each do |answer|
|
268
|
+
question_string << " {#{answer}} #{random_alphanums}"
|
269
|
+
end
|
270
|
+
defaults[:text]=question_string
|
271
|
+
|
272
|
+
options = defaults.merge(opts)
|
273
|
+
|
274
|
+
set_options(options)
|
275
|
+
requires @text
|
276
|
+
end
|
277
|
+
|
278
|
+
def create
|
279
|
+
# Note that this method presumes that it's being called from
|
280
|
+
# within methods in the AssessmentObject class, not directly
|
281
|
+
# in a test script, so no positioning navigation is set up.
|
282
|
+
on EditAssessment do |edit|
|
283
|
+
edit.question_type "Numeric Response"
|
284
|
+
end
|
285
|
+
on NumericResponse do |add|
|
286
|
+
add.question_text.set @text
|
287
|
+
add.answer_point_value.set @point_value
|
288
|
+
add.assign_to_part.select /#{@part}/
|
289
|
+
add.assign_to_pool.select @pool unless @pool==nil
|
290
|
+
add.correct_answer_feedback.fit @correct_answer_feedback
|
291
|
+
add.incorrect_answer_feedback.fit @incorrect_answer_feedback
|
292
|
+
add.save
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
def edit opts={}
|
297
|
+
|
298
|
+
set_options(opts)
|
299
|
+
end
|
300
|
+
|
301
|
+
def view
|
302
|
+
|
303
|
+
end
|
304
|
+
|
305
|
+
def delete
|
306
|
+
|
307
|
+
end
|
308
|
+
|
309
|
+
end
|
310
|
+
|
311
|
+
class MatchingQuestion
|
312
|
+
|
313
|
+
include Foundry
|
314
|
+
include DataFactory
|
315
|
+
include StringFactory
|
316
|
+
include Workflows
|
317
|
+
|
318
|
+
attr_accessor :text, :point_value, :pairs, :correct_answer_feedback, :incorrect_answer_feedback
|
319
|
+
|
320
|
+
def initialize(browser, opts={})
|
321
|
+
@browser = browser
|
322
|
+
|
323
|
+
defaults = {
|
324
|
+
:text=>random_alphanums,
|
325
|
+
:point_value=>(rand(100)+1).to_s,
|
326
|
+
:pairs=>[
|
327
|
+
{:choice=>random_alphanums, :match=>random_alphanums, :correct_match_feedback=>random_alphanums, :incorrect_match_feedback=>random_alphanums},
|
328
|
+
{:choice=>random_alphanums, :match=>random_alphanums, :correct_match_feedback=>random_alphanums, :incorrect_match_feedback=>random_alphanums},
|
329
|
+
{:choice=>random_alphanums, :match=>:distractor, :correct_match_feedback=>random_alphanums, :incorrect_match_feedback=>random_alphanums},
|
330
|
+
{:choice=>random_alphanums, :match=>random_alphanums, :correct_match_feedback=>random_alphanums, :incorrect_match_feedback=>random_alphanums},
|
331
|
+
{:choice=>random_alphanums, :match=>random_alphanums, :correct_match_feedback=>random_alphanums, :incorrect_match_feedback=>random_alphanums},
|
332
|
+
{:choice=>random_alphanums, :match=>:distractor, :correct_match_feedback=>random_alphanums, :incorrect_match_feedback=>random_alphanums}
|
333
|
+
]
|
334
|
+
}
|
335
|
+
options = defaults.merge(opts)
|
336
|
+
|
337
|
+
set_options(options)
|
338
|
+
requires @assessment
|
339
|
+
end
|
340
|
+
|
341
|
+
def create
|
342
|
+
# Note that this method presumes that it's being called from
|
343
|
+
# within methods in the AssessmentObject class, not directly
|
344
|
+
# in a test script, so no positioning navigation is set up.
|
345
|
+
on EditAssessment do |edit|
|
346
|
+
edit.question_type "Matching"
|
347
|
+
end
|
348
|
+
on Matching do |add|
|
349
|
+
add.question_text.set @text
|
350
|
+
add.answer_point_value.set @point_value
|
351
|
+
add.assign_to_part.select /#{@part}/
|
352
|
+
add.assign_to_pool.fit @pool
|
353
|
+
add.correct_answer_feedback.fit @correct_answer_feedback
|
354
|
+
add.incorrect_answer_feedback.fit @incorrect_answer_feedback
|
355
|
+
|
356
|
+
@pairs.each do |pair|
|
357
|
+
add.choice.set pair[:choice]
|
358
|
+
if pair[:match]==:distractor
|
359
|
+
add.distractor
|
360
|
+
else
|
361
|
+
add.match.set pair[:match]
|
362
|
+
end
|
363
|
+
if add.correct_match_feedback.present?
|
364
|
+
add.correct_match_feedback.fit pair[:correct_match_feedback]
|
365
|
+
add.incorrect_match_feedback.fit pair[:incorrect_match_feedback]
|
366
|
+
end
|
367
|
+
add.save_pairing
|
368
|
+
add.choice.wait_until_present
|
369
|
+
end
|
370
|
+
|
371
|
+
add.save
|
372
|
+
end
|
373
|
+
end
|
374
|
+
|
375
|
+
def edit opts={}
|
376
|
+
|
377
|
+
set_options(opts)
|
378
|
+
end
|
379
|
+
|
380
|
+
def view
|
381
|
+
|
382
|
+
end
|
383
|
+
|
384
|
+
def delete
|
385
|
+
|
386
|
+
end
|
387
|
+
|
388
|
+
end
|
389
|
+
|
390
|
+
class TrueFalseQuestion
|
391
|
+
|
392
|
+
include Foundry
|
393
|
+
include DataFactory
|
394
|
+
include StringFactory
|
395
|
+
include Workflows
|
396
|
+
|
397
|
+
attr_accessor :point_value, :text, :negative_point_value, :answer, :assessment, :part, :pool,
|
398
|
+
:correct_answer_feedback, :incorrect_answer_feedback, :required_rationale
|
399
|
+
|
400
|
+
ANSWERS = %w{true false}
|
401
|
+
|
402
|
+
def initialize(browser, opts={})
|
403
|
+
@browser = browser
|
404
|
+
|
405
|
+
defaults = {
|
406
|
+
:point_value=>(rand(100)+1).to_s,
|
407
|
+
:text=>random_alphanums,
|
408
|
+
:negative_point_value=>"0",
|
409
|
+
:answer=>ANSWERS[rand(2)]
|
410
|
+
}
|
411
|
+
options = defaults.merge(opts)
|
412
|
+
|
413
|
+
set_options(options)
|
414
|
+
requires @point_value
|
415
|
+
end
|
416
|
+
|
417
|
+
def create
|
418
|
+
# Note that this method presumes that it's being called from
|
419
|
+
# within methods in the AssessmentObject class, not directly
|
420
|
+
# in a test script, so no positioning navigation is set up.
|
421
|
+
on EditAssessment do |edit|
|
422
|
+
edit.question_type "True False"
|
423
|
+
end
|
424
|
+
on TrueFalse do |add|
|
425
|
+
add.question_text.set @text
|
426
|
+
add.answer_point_value.set @point_value
|
427
|
+
add.answer(@answer).set
|
428
|
+
add.assign_to_part.select /#{@part}/
|
429
|
+
add.assign_to_pool.fit @pool
|
430
|
+
add.correct_answer_feedback.fit @correct_answer_feedback
|
431
|
+
add.incorrect_answer_feedback.fit @incorrect_answer_feedback
|
432
|
+
add.require_rationale_yes.set if @require_rationale=="yes"
|
433
|
+
add.save
|
434
|
+
end
|
435
|
+
end
|
436
|
+
|
437
|
+
def edit opts={}
|
438
|
+
|
439
|
+
set_options(opts)
|
440
|
+
end
|
441
|
+
|
442
|
+
def view
|
443
|
+
|
444
|
+
end
|
445
|
+
|
446
|
+
def delete
|
447
|
+
|
448
|
+
end
|
449
|
+
|
450
|
+
end
|
451
|
+
|
452
|
+
class AudioRecordingQuestion
|
453
|
+
|
454
|
+
include Foundry
|
455
|
+
include DataFactory
|
456
|
+
include StringFactory
|
457
|
+
include Workflows
|
458
|
+
|
459
|
+
attr_accessor :text, :point_value, :time_allowed, :number_of_attempts, :part, :pool, :feedback
|
460
|
+
|
461
|
+
def initialize(browser, opts={})
|
462
|
+
@browser = browser
|
463
|
+
|
464
|
+
defaults = {
|
465
|
+
:text=>random_alphanums,
|
466
|
+
:point_value=>(rand(100)+1).to_s,
|
467
|
+
:time_allowed=>(rand(600)+1).to_s,
|
468
|
+
:number_of_attempts=>(rand(10)+1).to_s,
|
469
|
+
}
|
470
|
+
options = defaults.merge(opts)
|
471
|
+
|
472
|
+
set_options(options)
|
473
|
+
requires @text
|
474
|
+
end
|
475
|
+
|
476
|
+
def create
|
477
|
+
# Note that this method presumes that it's being called from
|
478
|
+
# within methods in the AssessmentObject class, not directly
|
479
|
+
# in a test script, so no positioning navigation is set up.
|
480
|
+
on EditAssessment do |edit|
|
481
|
+
edit.question_type "Audio Recording"
|
482
|
+
end
|
483
|
+
on AudioRecording do |add|
|
484
|
+
add.question_text.set @text
|
485
|
+
add.answer_point_value.set @point_value
|
486
|
+
add.time_allowed.set @time_allowed
|
487
|
+
add.number_of_attempts.select @number_of_attempts
|
488
|
+
add.assign_to_part.select /#{@part}/
|
489
|
+
add.assign_to_pool.fit @pool
|
490
|
+
add.feedback.fit @feedback
|
491
|
+
add.save
|
492
|
+
end
|
493
|
+
end
|
494
|
+
|
495
|
+
def edit opts={}
|
496
|
+
|
497
|
+
set_options(opts)
|
498
|
+
end
|
499
|
+
|
500
|
+
def view
|
501
|
+
|
502
|
+
end
|
503
|
+
|
504
|
+
def delete
|
505
|
+
|
506
|
+
end
|
507
|
+
|
508
|
+
end
|
509
|
+
|
510
|
+
class FileUploadQuestion
|
511
|
+
|
512
|
+
include Foundry
|
513
|
+
include DataFactory
|
514
|
+
include StringFactory
|
515
|
+
include Workflows
|
516
|
+
|
517
|
+
attr_accessor :text, :point_value, :part, :pool, :feedback
|
518
|
+
|
519
|
+
def initialize(browser, opts={})
|
520
|
+
@browser = browser
|
521
|
+
|
522
|
+
defaults = {
|
523
|
+
:text=>random_alphanums,
|
524
|
+
:point_value=>(rand(100)+1).to_s
|
525
|
+
}
|
526
|
+
options = defaults.merge(opts)
|
527
|
+
|
528
|
+
set_options(options)
|
529
|
+
requires @text
|
530
|
+
end
|
531
|
+
|
532
|
+
def create
|
533
|
+
# Note that this method presumes that it's being called from
|
534
|
+
# within methods in the AssessmentObject class, not directly
|
535
|
+
# in a test script, so no positioning navigation is set up.
|
536
|
+
on EditAssessment do |edit|
|
537
|
+
edit.question_type "File Upload"
|
538
|
+
end
|
539
|
+
on FileUpload do |add|
|
540
|
+
add.question_text.set @text
|
541
|
+
add.answer_point_value.set @point_value
|
542
|
+
add.assign_to_part.select /#{@part}/
|
543
|
+
add.assign_to_pool.fit @pool
|
544
|
+
add.feedback.fit @feedback
|
545
|
+
add.save
|
546
|
+
end
|
547
|
+
end
|
548
|
+
|
549
|
+
def edit opts={}
|
550
|
+
|
551
|
+
set_options(opts)
|
552
|
+
end
|
553
|
+
|
554
|
+
def view
|
555
|
+
|
556
|
+
end
|
557
|
+
|
558
|
+
def delete
|
559
|
+
|
560
|
+
end
|
561
|
+
|
562
|
+
end
|
563
|
+
|
564
|
+
class CalculatedQuestion
|
565
|
+
|
566
|
+
include Foundry
|
567
|
+
include DataFactory
|
568
|
+
include StringFactory
|
569
|
+
include Workflows
|
570
|
+
|
571
|
+
attr_accessor :text, :point_value, :variables, :formulas, :part, :pool
|
572
|
+
|
573
|
+
#TODO: Add randomization to this class!
|
574
|
+
|
575
|
+
def initialize(browser, opts={})
|
576
|
+
@browser = browser
|
577
|
+
|
578
|
+
defaults = {
|
579
|
+
:text=>"Two cars left from the same point at the same time, one traveling East at {x} mph and the other traveling South at {y} mph. In how many minutes will they be {z} miles apart?\n\nRound to the nearest minute.\n\n{{abc}}",
|
580
|
+
:variables=>{
|
581
|
+
:x=>{:min=>rand(50)+1,:max=>rand(50)+51, :decimals=>rand(11)},
|
582
|
+
:y=>{:min=>rand(50)+1,:max=>rand(50)+51, :decimals=>rand(11)},
|
583
|
+
:z=>{:min=>rand(50)+1,:max=>rand(50)+51, :decimals=>rand(11)}
|
584
|
+
},
|
585
|
+
:formulas=>[{
|
586
|
+
:name=>"abc",
|
587
|
+
:text=>"SQRT({z}^2/({x}^2+{y}^2))*60",
|
588
|
+
:tolerance=>"0.01",
|
589
|
+
:decimals=>"0"
|
590
|
+
}],
|
591
|
+
:point_value=>(rand(100)+1).to_s
|
592
|
+
}
|
593
|
+
|
594
|
+
options = defaults.merge(opts)
|
595
|
+
|
596
|
+
set_options(options)
|
597
|
+
requires @text
|
598
|
+
end
|
599
|
+
|
600
|
+
def calculation(x, y, z)
|
601
|
+
(Math.sqrt((z**2)/((x**2)+(y**2))))*60
|
602
|
+
end
|
603
|
+
|
604
|
+
def create
|
605
|
+
on EditAssessment do |edit|
|
606
|
+
edit.question_type "Calculated Question"
|
607
|
+
end
|
608
|
+
on CalculatedQuestions do |add|
|
609
|
+
add.question_text.set @text
|
610
|
+
add.answer_point_value.set @point_value
|
611
|
+
add.assign_to_part.select /#{@part}/
|
612
|
+
add.assign_to_pool.fit @pool
|
613
|
+
add.question_text.set @text
|
614
|
+
add.extract_vs_and_fs
|
615
|
+
|
616
|
+
@variables.each do |name, attribs|
|
617
|
+
var = name.to_s
|
618
|
+
add.min_value(var).set attribs[:min]
|
619
|
+
add.max_value(var).set attribs[:max]
|
620
|
+
add.var_decimals(var).select attribs[:decimals]
|
621
|
+
end
|
622
|
+
@formulas.each do |formula|
|
623
|
+
add.formula(formula[:name]).set formula[:text]
|
624
|
+
add.tolerance(formula[:name]).set formula[:tolerance]
|
625
|
+
add.form_decimals(formula[:name]).select formula[:decimals]
|
626
|
+
end
|
627
|
+
add.correct_answer_feedback.fit @correct_answer_feedback
|
628
|
+
add.incorrect_answer_feedback.fit @incorrect_answer_feedback
|
629
|
+
add.save
|
630
|
+
end
|
631
|
+
end
|
632
|
+
|
633
|
+
def edit opts={}
|
634
|
+
|
635
|
+
set_options(opts)
|
636
|
+
end
|
637
|
+
|
638
|
+
def view
|
639
|
+
|
640
|
+
end
|
641
|
+
|
642
|
+
def delete
|
643
|
+
|
644
|
+
end
|
645
|
+
|
646
|
+
end
|
647
|
+
|
648
|
+
# TODO: Finish defining this class
|
649
|
+
class PoolObject #TODO: Someday add support for sub pools
|
650
|
+
|
651
|
+
include Foundry
|
652
|
+
include DataFactory
|
653
|
+
include StringFactory
|
654
|
+
include Workflows
|
655
|
+
|
656
|
+
attr_accessor :site, :name, :questions, :creator, :department, :description,
|
657
|
+
:objectives, :keywords
|
658
|
+
|
659
|
+
def initialize(browser, opts={})
|
660
|
+
@browser = browser
|
661
|
+
|
662
|
+
defaults = {
|
663
|
+
:name=>random_alphanums
|
664
|
+
}
|
665
|
+
options = defaults.merge(opts)
|
666
|
+
|
667
|
+
set_options(options)
|
668
|
+
requires @site
|
669
|
+
end
|
670
|
+
|
671
|
+
alias :group :department
|
672
|
+
|
673
|
+
def create
|
674
|
+
|
675
|
+
end
|
676
|
+
|
677
|
+
def edit opts={}
|
678
|
+
|
679
|
+
set_options(opts)
|
680
|
+
end
|
681
|
+
|
682
|
+
def view
|
683
|
+
|
684
|
+
end
|
685
|
+
|
686
|
+
def delete
|
687
|
+
|
688
|
+
end
|
689
|
+
|
690
|
+
end
|