Class: FillInBlankQuestion

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

Returns a new instance of FillInBlankQuestion.



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/sambal-cle/data_objects/questions.rb', line 213

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
  options = defaults.merge(opts)

  set_options(options)
  requires @assessment
end

Instance Attribute Details

#answersObject

Returns the value of attribute answers.



208
209
210
# File 'lib/sambal-cle/data_objects/questions.rb', line 208

def answers
  @answers
end

#assessmentObject

Returns the value of attribute assessment.



208
209
210
# File 'lib/sambal-cle/data_objects/questions.rb', line 208

def assessment
  @assessment
end

#case_sensitiveObject

Returns the value of attribute case_sensitive.



208
209
210
# File 'lib/sambal-cle/data_objects/questions.rb', line 208

def case_sensitive
  @case_sensitive
end

#correct_answer_feedbackObject

Returns the value of attribute correct_answer_feedback.



208
209
210
# File 'lib/sambal-cle/data_objects/questions.rb', line 208

def correct_answer_feedback
  @correct_answer_feedback
end

#incorrect_answer_feedbackObject

Returns the value of attribute incorrect_answer_feedback.



208
209
210
# File 'lib/sambal-cle/data_objects/questions.rb', line 208

def incorrect_answer_feedback
  @incorrect_answer_feedback
end

#mutually_exclusiveObject

Returns the value of attribute mutually_exclusive.



208
209
210
# File 'lib/sambal-cle/data_objects/questions.rb', line 208

def mutually_exclusive
  @mutually_exclusive
end

#partObject

Returns the value of attribute part.



208
209
210
# File 'lib/sambal-cle/data_objects/questions.rb', line 208

def part
  @part
end

#point_valueObject

Returns the value of attribute point_value.



208
209
210
# File 'lib/sambal-cle/data_objects/questions.rb', line 208

def point_value
  @point_value
end

#poolObject

Returns the value of attribute pool.



208
209
210
# File 'lib/sambal-cle/data_objects/questions.rb', line 208

def pool
  @pool
end

#textObject

Returns the value of attribute text.



208
209
210
# File 'lib/sambal-cle/data_objects/questions.rb', line 208

def text
  @text
end

Instance Method Details

#createObject



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/sambal-cle/data_objects/questions.rb', line 231

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



250
251
252
253
# File 'lib/sambal-cle/data_objects/questions.rb', line 250

def edit opts={}

  set_options(opts)
end