Class: SurveyQuestion
- Inherits:
-
Object
- Object
- SurveyQuestion
- Includes:
- DataFactory, Foundry, StringFactory, Workflows
- Defined in:
- lib/sambal-cle/data_objects/questions.rb
Constant Summary collapse
- ANSWERS =
[ :yes_no, :disagree_agree, :disagree_undecided, :below_above, :strongly_agree, :unacceptable_excellent, :one_to_five, :one_to_ten ]
Instance Attribute Summary collapse
-
#answer ⇒ Object
Returns the value of attribute answer.
-
#assessment ⇒ Object
Returns the value of attribute assessment.
-
#feedback ⇒ Object
Returns the value of attribute feedback.
-
#part ⇒ Object
Returns the value of attribute part.
-
#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 = {}) ⇒ SurveyQuestion
constructor
A new instance of SurveyQuestion.
Methods included from Workflows
menu_link, #open_my_site_by_name, #reset
Constructor Details
#initialize(browser, opts = {}) ⇒ SurveyQuestion
Returns a new instance of SurveyQuestion.
109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 109 def initialize(browser, opts={}) @browser = browser defaults = { :text=>random_alphanums, :answer=>ANSWERS[rand(ANSWERS.length)] } = defaults.merge(opts) () requires @assessment end |
Instance Attribute Details
#answer ⇒ Object
Returns the value of attribute answer.
96 97 98 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 96 def answer @answer end |
#assessment ⇒ Object
Returns the value of attribute assessment.
96 97 98 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 96 def assessment @assessment end |
#feedback ⇒ Object
Returns the value of attribute feedback.
96 97 98 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 96 def feedback @feedback end |
#part ⇒ Object
Returns the value of attribute part.
96 97 98 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 96 def part @part end |
#pool ⇒ Object
Returns the value of attribute pool.
96 97 98 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 96 def pool @pool end |
#text ⇒ Object
Returns the value of attribute text.
96 97 98 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 96 def text @text end |
Instance Method Details
#create ⇒ Object
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 122 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 "Survey" end on Survey do |add| add.question_text.set @text add.send(@answer).set add.assign_to_part.select /#{@part}/ add.assign_to_pool.fit @pool add.feedback.fit @feedback add.save end end |
#edit(opts = {}) ⇒ Object
139 140 141 142 |
# File 'lib/sambal-cle/data_objects/questions.rb', line 139 def edit opts={} #TODO (opts) end |