Module: QuestionHelpers

Overview

This is a module containing methods that are common to all the question pages inside the Assessment section of a Site.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

Encapsulates all the PageObject code into a module method that can be called from the necessary class.



34
35
36
37
38
39
40
41
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 34

def self.menu_elements(identifier)
  in_frame(identifier) do |frame|
    link(:assessments, :text=>"Assessments", :frame=>frame)
    link(:assessment_types, :text=>"Assessment Types", :frame=>frame)
    link(:question_pools, :text=>"Question Pools", :frame=>frame)
    link(:questions, :text=>/Questions:/, :frame=>frame)
  end
end

Instance Method Details

#saveObject

Saves the question by clicking the Save button, then makes the determination whether to instantiate the EditAssessment class, or the EditQuestionPool class.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/kuali-sakai-common-lib/assessments.rb', line 12

def save

  quiz = frm.div(:class=>"portletBody").div(:index=>0).text
  pool = frm.div(:class=>"portletBody").div(:index=>1).text

  frm.button(:value=>"Save").click

  if quiz =~ /^Assessments/
    EditAssessment.new(@browser)
  elsif pool =~ /^Question Pools/
    EditQuestionPool.new(@browser)
  else
    puts "Unexpected text: "
    p pool
    p quiz
  end

end