Class: NumericResponseQuestion
- Inherits:
-
Object
- Object
- NumericResponseQuestion
- Includes:
- DataFactory, Foundry, StringFactory, Workflows
- Defined in:
- lib/sambal-cle/data_objects/questions.rb
Instance Attribute Summary collapse
-
#answers ⇒ Object
Returns the value of attribute answers.
-
#correct_answer_feedback ⇒ Object
Returns the value of attribute correct_answer_feedback.
-
#incorrect_answer_feedback ⇒ Object
Returns the value of attribute incorrect_answer_feedback.
-
#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.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #create ⇒ Object
- #delete ⇒ Object
- #edit(opts = {}) ⇒ Object
-
#initialize(browser, opts = {}) ⇒ NumericResponseQuestion
constructor
A new instance of NumericResponseQuestion.
- #view ⇒ Object
Methods included from Workflows
menu_link, #open_my_site_by_name, #reset
Constructor Details
#initialize(browser, opts = {}) ⇒ NumericResponseQuestion
Returns a new instance of NumericResponseQuestion.
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 266 def initialize(browser, opts={}) @browser = browser defaults = { :answers=>[rand(2000), rand(10000000)], :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 = defaults.merge(opts) () requires @text end |
Instance Attribute Details
#answers ⇒ Object
Returns the value of attribute answers.
264 265 266 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 264 def answers @answers end |
#correct_answer_feedback ⇒ Object
Returns the value of attribute correct_answer_feedback.
264 265 266 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 264 def correct_answer_feedback @correct_answer_feedback end |
#incorrect_answer_feedback ⇒ Object
Returns the value of attribute incorrect_answer_feedback.
264 265 266 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 264 def incorrect_answer_feedback @incorrect_answer_feedback end |
#part ⇒ Object
Returns the value of attribute part.
264 265 266 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 264 def part @part end |
#point_value ⇒ Object
Returns the value of attribute point_value.
264 265 266 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 264 def point_value @point_value end |
#pool ⇒ Object
Returns the value of attribute pool.
264 265 266 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 264 def pool @pool end |
#text ⇒ Object
Returns the value of attribute text.
264 265 266 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 264 def text @text end |
Instance Method Details
#create ⇒ Object
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 285 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 "Numeric Response" end on NumericResponse do |add| add.question_text.set @text add.answer_point_value.set @point_value add.assign_to_part.select /#{@part}/ add.assign_to_pool.select @pool unless @pool==nil add.correct_answer_feedback.fit @correct_answer_feedback add.incorrect_answer_feedback.fit @incorrect_answer_feedback add.save end end |
#delete ⇒ Object
312 313 314 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 312 def delete end |
#edit(opts = {}) ⇒ Object
303 304 305 306 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 303 def edit opts={} (opts) end |
#view ⇒ Object
308 309 310 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 308 def view end |