Class: FillInBlankQuestion
- Inherits:
-
Object
- Object
- FillInBlankQuestion
- 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.
-
#assessment ⇒ Object
Returns the value of attribute assessment.
-
#case_sensitive ⇒ Object
Returns the value of attribute case_sensitive.
-
#correct_answer_feedback ⇒ Object
Returns the value of attribute correct_answer_feedback.
-
#incorrect_answer_feedback ⇒ Object
Returns the value of attribute incorrect_answer_feedback.
-
#mutually_exclusive ⇒ Object
Returns the value of attribute mutually_exclusive.
-
#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
- #edit(opts = {}) ⇒ Object
-
#initialize(browser, opts = {}) ⇒ FillInBlankQuestion
constructor
A new instance of FillInBlankQuestion.
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 = defaults.merge(opts) () requires @assessment end |
Instance Attribute Details
#answers ⇒ Object
Returns the value of attribute answers.
208 209 210 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 208 def answers @answers end |
#assessment ⇒ Object
Returns the value of attribute assessment.
208 209 210 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 208 def assessment @assessment end |
#case_sensitive ⇒ Object
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_feedback ⇒ Object
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_feedback ⇒ Object
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_exclusive ⇒ Object
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 |
#part ⇒ Object
Returns the value of attribute part.
208 209 210 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 208 def part @part end |
#point_value ⇒ Object
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 |
#pool ⇒ Object
Returns the value of attribute pool.
208 209 210 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 208 def pool @pool end |
#text ⇒ Object
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
#create ⇒ Object
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={} (opts) end |