Class: ShortAnswerQuestion

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

Returns a new instance of ShortAnswerQuestion.



156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/sambal-cle/data_objects/questions.rb', line 156

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

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

  set_options(options)
  requires @assessment, @part
end

Instance Attribute Details

#assessmentObject

Returns the value of attribute assessment.



154
155
156
# File 'lib/sambal-cle/data_objects/questions.rb', line 154

def assessment
  @assessment
end

#feedbackObject

Returns the value of attribute feedback.



154
155
156
# File 'lib/sambal-cle/data_objects/questions.rb', line 154

def feedback
  @feedback
end

#model_answerObject

Returns the value of attribute model_answer.



154
155
156
# File 'lib/sambal-cle/data_objects/questions.rb', line 154

def model_answer
  @model_answer
end

#partObject

Returns the value of attribute part.



154
155
156
# File 'lib/sambal-cle/data_objects/questions.rb', line 154

def part
  @part
end

#point_valueObject

Returns the value of attribute point_value.



154
155
156
# File 'lib/sambal-cle/data_objects/questions.rb', line 154

def point_value
  @point_value
end

#poolObject

Returns the value of attribute pool.



154
155
156
# File 'lib/sambal-cle/data_objects/questions.rb', line 154

def pool
  @pool
end

#textObject

Returns the value of attribute text.



154
155
156
# File 'lib/sambal-cle/data_objects/questions.rb', line 154

def text
  @text
end

Instance Method Details

#createObject



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/sambal-cle/data_objects/questions.rb', line 170

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 "Short Answer/Essay"
  end
  on ShortAnswer do |add|
    add.question_text.set @text
    add.answer_point_value.set @point_value
    add.model_short_answer.set @model_answer
    add.feedback.fit @feedback
    add.assign_to_part.select /#{@part}/
    add.assign_to_pool.fit @pool
    add.save
  end
end

#edit(opts = {}) ⇒ Object



188
189
190
# File 'lib/sambal-cle/data_objects/questions.rb', line 188

def edit opts={}
  #TODO
end