Class: TrueFalseQuestion
- Inherits:
-
Object
- Object
- TrueFalseQuestion
- 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
-
#answer ⇒ Object
Returns the value of attribute answer.
-
#assessment ⇒ Object
Returns the value of attribute assessment.
-
#correct_answer_feedback ⇒ Object
Returns the value of attribute correct_answer_feedback.
-
#incorrect_answer_feedback ⇒ Object
Returns the value of attribute incorrect_answer_feedback.
-
#negative_point_value ⇒ Object
Returns the value of attribute negative_point_value.
-
#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.
-
#required_rationale ⇒ Object
Returns the value of attribute required_rationale.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #create ⇒ Object
- #delete ⇒ Object
- #edit(opts = {}) ⇒ Object
-
#initialize(browser, opts = {}) ⇒ TrueFalseQuestion
constructor
A new instance of TrueFalseQuestion.
- #view ⇒ Object
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)] } = defaults.merge(opts) () requires @point_value end |
Instance Attribute Details
#answer ⇒ Object
Returns the value of attribute answer.
404 405 406 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 404 def answer @answer end |
#assessment ⇒ Object
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_feedback ⇒ Object
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_feedback ⇒ Object
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_value ⇒ Object
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 |
#part ⇒ Object
Returns the value of attribute part.
404 405 406 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 404 def part @part end |
#point_value ⇒ Object
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 |
#pool ⇒ Object
Returns the value of attribute pool.
404 405 406 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 404 def pool @pool end |
#required_rationale ⇒ Object
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 |
#text ⇒ Object
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
#create ⇒ Object
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 |
#delete ⇒ Object
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={} (opts) end |
#view ⇒ Object
449 450 451 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 449 def view end |