Class: FileUploadQuestion

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

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 = {}) ⇒ FileUploadQuestion

Returns a new instance of FileUploadQuestion.



526
527
528
529
530
531
532
533
534
535
536
537
# File 'lib/sambal-cle/data_objects/questions.rb', line 526

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

  defaults = {
      :text=>random_alphanums,
      :point_value=>(rand(100)+1).to_s
  }
  options = defaults.merge(opts)

  set_options(options)
  requires @text
end

Instance Attribute Details

#feedbackObject

Returns the value of attribute feedback.



524
525
526
# File 'lib/sambal-cle/data_objects/questions.rb', line 524

def feedback
  @feedback
end

#partObject

Returns the value of attribute part.



524
525
526
# File 'lib/sambal-cle/data_objects/questions.rb', line 524

def part
  @part
end

#point_valueObject

Returns the value of attribute point_value.



524
525
526
# File 'lib/sambal-cle/data_objects/questions.rb', line 524

def point_value
  @point_value
end

#poolObject

Returns the value of attribute pool.



524
525
526
# File 'lib/sambal-cle/data_objects/questions.rb', line 524

def pool
  @pool
end

#textObject

Returns the value of attribute text.



524
525
526
# File 'lib/sambal-cle/data_objects/questions.rb', line 524

def text
  @text
end

Instance Method Details

#createObject



539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
# File 'lib/sambal-cle/data_objects/questions.rb', line 539

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 "File Upload"
  end
  on FileUpload do |add|
    add.question_text.set @text
    add.answer_point_value.set @point_value
    add.assign_to_part.select /#{@part}/
    add.assign_to_pool.fit @pool
    add.feedback.fit @feedback
    add.save
  end
end

#deleteObject



565
566
567
# File 'lib/sambal-cle/data_objects/questions.rb', line 565

def delete

end

#edit(opts = {}) ⇒ Object



556
557
558
559
# File 'lib/sambal-cle/data_objects/questions.rb', line 556

def edit opts={}

  set_options(opts)
end

#viewObject



561
562
563
# File 'lib/sambal-cle/data_objects/questions.rb', line 561

def view

end