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.



519
520
521
522
523
524
525
526
527
528
529
530
# File 'lib/sambal-cle/data_objects/questions.rb', line 519

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.



517
518
519
# File 'lib/sambal-cle/data_objects/questions.rb', line 517

def feedback
  @feedback
end

#partObject

Returns the value of attribute part.



517
518
519
# File 'lib/sambal-cle/data_objects/questions.rb', line 517

def part
  @part
end

#point_valueObject

Returns the value of attribute point_value.



517
518
519
# File 'lib/sambal-cle/data_objects/questions.rb', line 517

def point_value
  @point_value
end

#poolObject

Returns the value of attribute pool.



517
518
519
# File 'lib/sambal-cle/data_objects/questions.rb', line 517

def pool
  @pool
end

#textObject

Returns the value of attribute text.



517
518
519
# File 'lib/sambal-cle/data_objects/questions.rb', line 517

def text
  @text
end

Instance Method Details

#createObject



532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
# File 'lib/sambal-cle/data_objects/questions.rb', line 532

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



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

def delete

end

#edit(opts = {}) ⇒ Object



549
550
551
552
# File 'lib/sambal-cle/data_objects/questions.rb', line 549

def edit opts={}

  set_options(opts)
end

#viewObject



554
555
556
# File 'lib/sambal-cle/data_objects/questions.rb', line 554

def view

end