Class: ShortAnswerQuestion
- Inherits:
-
Object
- Object
- ShortAnswerQuestion
- Includes:
- DataFactory, Foundry, StringFactory, Workflows
- Defined in:
- lib/sambal-cle/data_objects/questions.rb
Instance Attribute Summary collapse
-
#assessment ⇒ Object
Returns the value of attribute assessment.
-
#feedback ⇒ Object
Returns the value of attribute feedback.
-
#model_answer ⇒ Object
Returns the value of attribute model_answer.
-
#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.
-
#rich_text ⇒ Object
Returns the value of attribute rich_text.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #create ⇒ Object
- #edit(opts = {}) ⇒ Object
-
#initialize(browser, opts = {}) ⇒ ShortAnswerQuestion
constructor
A new instance of ShortAnswerQuestion.
Methods included from Workflows
menu_link, #open_my_site_by_name, #reset
Constructor Details
#initialize(browser, opts = {}) ⇒ ShortAnswerQuestion
Returns a new instance of ShortAnswerQuestion.
157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 157 def initialize(browser, opts={}) @browser = browser defaults = { :text=>random_alphanums, :point_value=>(rand(100)+1).to_s, :model_answer=>random_alphanums, :rich_text=>false } = defaults.merge(opts) () requires @assessment, @part end |
Instance Attribute Details
#assessment ⇒ Object
Returns the value of attribute assessment.
154 155 156 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 154 def assessment @assessment end |
#feedback ⇒ Object
Returns the value of attribute feedback.
154 155 156 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 154 def feedback @feedback end |
#model_answer ⇒ Object
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 |
#part ⇒ Object
Returns the value of attribute part.
154 155 156 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 154 def part @part end |
#point_value ⇒ Object
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 |
#pool ⇒ Object
Returns the value of attribute pool.
154 155 156 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 154 def pool @pool end |
#rich_text ⇒ Object
Returns the value of attribute rich_text.
154 155 156 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 154 def rich_text @rich_text end |
#text ⇒ Object
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
#create ⇒ Object
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 172 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| if @rich_text add.toggle_question_editor add.enter_source_text(add.question_editor, @text) else add.question_text.set @text end 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
195 196 197 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 195 def edit opts={} #TODO end |