Class: FillInBlankQuestion
- Inherits:
-
Object
- Object
- FillInBlankQuestion
- Includes:
- DataFactory, Foundry, StringFactory, Workflows
- Defined in:
- lib/sambal-cle/data_objects/questions.rb
Instance Attribute Summary collapse
-
#answers ⇒ Object
Returns the value of attribute answers.
-
#assessment ⇒ Object
Returns the value of attribute assessment.
-
#case_sensitive ⇒ Object
Returns the value of attribute case_sensitive.
-
#correct_answer_feedback ⇒ Object
Returns the value of attribute correct_answer_feedback.
-
#incorrect_answer_feedback ⇒ Object
Returns the value of attribute incorrect_answer_feedback.
-
#mutually_exclusive ⇒ Object
Returns the value of attribute mutually_exclusive.
-
#part ⇒ Object
Returns the value of attribute part.
-
#point_value ⇒ Object
Returns the value of attribute point_value.
-
#pool ⇒ Object
Returns the value of attribute pool.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #create ⇒ Object
- #edit(opts = {}) ⇒ Object
-
#initialize(browser, opts = {}) ⇒ FillInBlankQuestion
constructor
A new instance of FillInBlankQuestion.
Methods included from Workflows
menu_link, #open_my_site_by_name, #reset
Constructor Details
#initialize(browser, opts = {}) ⇒ FillInBlankQuestion
Returns a new instance of FillInBlankQuestion.
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 206 def initialize(browser, opts={}) @browser = browser defaults = { :answers=>[random_alphanums, random_alphanums], :point_value=>(rand(100)+1).to_s } question_string = random_alphanums defaults[:answers].each do |answer| question_string << " {#{answer}} #{random_alphanums}" end defaults[:text]=question_string = defaults.merge(opts) () requires @assessment end |
Instance Attribute Details
#answers ⇒ Object
Returns the value of attribute answers.
201 202 203 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 201 def answers @answers end |
#assessment ⇒ Object
Returns the value of attribute assessment.
201 202 203 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 201 def assessment @assessment end |
#case_sensitive ⇒ Object
Returns the value of attribute case_sensitive.
201 202 203 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 201 def case_sensitive @case_sensitive end |
#correct_answer_feedback ⇒ Object
Returns the value of attribute correct_answer_feedback.
201 202 203 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 201 def correct_answer_feedback @correct_answer_feedback end |
#incorrect_answer_feedback ⇒ Object
Returns the value of attribute incorrect_answer_feedback.
201 202 203 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 201 def incorrect_answer_feedback @incorrect_answer_feedback end |
#mutually_exclusive ⇒ Object
Returns the value of attribute mutually_exclusive.
201 202 203 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 201 def mutually_exclusive @mutually_exclusive end |
#part ⇒ Object
Returns the value of attribute part.
201 202 203 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 201 def part @part end |
#point_value ⇒ Object
Returns the value of attribute point_value.
201 202 203 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 201 def point_value @point_value end |
#pool ⇒ Object
Returns the value of attribute pool.
201 202 203 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 201 def pool @pool end |
#text ⇒ Object
Returns the value of attribute text.
201 202 203 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 201 def text @text end |
Instance Method Details
#create ⇒ Object
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 224 def create # Note that this method presumes that it's being called from # within methods in the AssessmentObject class, not directly # in a test script, so no positioning navigation is set up. on EditAssessment do |edit| edit.question_type "Fill in the Blank" end on FillInBlank do |add| add.question_text.set @text add.answer_point_value.set @point_value add.case_sensitive.send(@case_sensitive) unless @case_sensitive==nil add.mutually_exclusive.send(@mutually_exclusive) unless @mutually_exclusive==nil add.feedback.fit @feedback add.assign_to_part.select /#{@part}/ add.assign_to_pool.fit @pool add.save end end |
#edit(opts = {}) ⇒ Object
243 244 245 246 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 243 def edit opts={} (opts) end |