Class: TrueFalseQuestion

Inherits:
Object
  • Object
show all
Includes:
DataFactory, Foundry, StringFactory, Workflows
Defined in:
lib/sambal-cle/data_objects/questions.rb

Constant Summary collapse

ANSWERS =
%w{true false}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Workflows

menu_link, #open_my_site_by_name, #reset

Constructor Details

#initialize(browser, opts = {}) ⇒ TrueFalseQuestion

Returns a new instance of TrueFalseQuestion.



409
410
411
412
413
414
415
416
417
418
419
420
421
422
# File 'lib/sambal-cle/data_objects/questions.rb', line 409

def initialize(browser, opts={})
  @browser = browser

  defaults = {
      :point_value=>(rand(100)+1).to_s,
      :text=>random_alphanums,
      :negative_point_value=>"0",
      :answer=>ANSWERS[rand(2)]
  }
  options = defaults.merge(opts)

  set_options(options)
  requires @point_value
end

Instance Attribute Details

#answerObject

Returns the value of attribute answer.



404
405
406
# File 'lib/sambal-cle/data_objects/questions.rb', line 404

def answer
  @answer
end

#assessmentObject

Returns the value of attribute assessment.



404
405
406
# File 'lib/sambal-cle/data_objects/questions.rb', line 404

def assessment
  @assessment
end

#correct_answer_feedbackObject

Returns the value of attribute correct_answer_feedback.



404
405
406
# File 'lib/sambal-cle/data_objects/questions.rb', line 404

def correct_answer_feedback
  @correct_answer_feedback
end

#incorrect_answer_feedbackObject

Returns the value of attribute incorrect_answer_feedback.



404
405
406
# File 'lib/sambal-cle/data_objects/questions.rb', line 404

def incorrect_answer_feedback
  @incorrect_answer_feedback
end

#negative_point_valueObject

Returns the value of attribute negative_point_value.



404
405
406
# File 'lib/sambal-cle/data_objects/questions.rb', line 404

def negative_point_value
  @negative_point_value
end

#partObject

Returns the value of attribute part.



404
405
406
# File 'lib/sambal-cle/data_objects/questions.rb', line 404

def part
  @part
end

#point_valueObject

Returns the value of attribute point_value.



404
405
406
# File 'lib/sambal-cle/data_objects/questions.rb', line 404

def point_value
  @point_value
end

#poolObject

Returns the value of attribute pool.



404
405
406
# File 'lib/sambal-cle/data_objects/questions.rb', line 404

def pool
  @pool
end

#required_rationaleObject

Returns the value of attribute required_rationale.



404
405
406
# File 'lib/sambal-cle/data_objects/questions.rb', line 404

def required_rationale
  @required_rationale
end

#textObject

Returns the value of attribute text.



404
405
406
# File 'lib/sambal-cle/data_objects/questions.rb', line 404

def text
  @text
end

Instance Method Details

#createObject



424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
# File 'lib/sambal-cle/data_objects/questions.rb', line 424

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 "True False"
  end
  on TrueFalse do |add|
    add.question_text.set @text
    add.answer_point_value.set @point_value
    add.answer(@answer).set
    add.assign_to_part.select /#{@part}/
    add.assign_to_pool.fit @pool
    add.correct_answer_feedback.fit @correct_answer_feedback
    add.incorrect_answer_feedback.fit @incorrect_answer_feedback
    add.require_rationale_yes.set if @require_rationale=="yes"
    add.save
  end
end

#deleteObject



453
454
455
# File 'lib/sambal-cle/data_objects/questions.rb', line 453

def delete

end

#edit(opts = {}) ⇒ Object



444
445
446
447
# File 'lib/sambal-cle/data_objects/questions.rb', line 444

def edit opts={}

  set_options(opts)
end

#viewObject



449
450
451
# File 'lib/sambal-cle/data_objects/questions.rb', line 449

def view

end