Class: AssignmentObject
- Inherits:
-
Object
- Object
- AssignmentObject
- Includes:
- PageHelper, Utilities, Workflows
- Defined in:
- lib/sakai-cle-test-api/data_objects/assignment.rb
Instance Attribute Summary collapse
-
#allow_resubmission ⇒ Object
Returns the value of attribute allow_resubmission.
-
#description ⇒ Object
Returns the value of attribute description.
-
#direct_url ⇒ Object
Returns the value of attribute direct_url.
-
#grade_scale ⇒ Object
Returns the value of attribute grade_scale.
-
#id ⇒ Object
Returns the value of attribute id.
-
#instructions ⇒ Object
Returns the value of attribute instructions.
-
#link ⇒ Object
Returns the value of attribute link.
-
#max_points ⇒ Object
Returns the value of attribute max_points.
-
#num_resubmissions ⇒ Object
Returns the value of attribute num_resubmissions.
-
#portal_url ⇒ Object
Returns the value of attribute portal_url.
-
#retract_time ⇒ Object
Returns the value of attribute retract_time.
-
#site ⇒ Object
Returns the value of attribute site.
-
#status ⇒ Object
Returns the value of attribute status.
-
#time_created ⇒ Object
Returns the value of attribute time_created.
-
#time_due ⇒ Object
Returns the value of attribute time_due.
-
#time_modified ⇒ Object
Returns the value of attribute time_modified.
-
#title ⇒ Object
(also: #name)
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #create ⇒ Object
- #edit(opts = {}) ⇒ Object
- #get_info ⇒ Object
-
#initialize(browser, opts = {}) ⇒ AssignmentObject
constructor
A new instance of AssignmentObject.
Methods included from Workflows
menu_link, #open_my_site_by_name
Methods included from Utilities
#current_hour, #current_month, #current_year, #get_filename, #in_15_minutes, #last_hour, #last_month, #last_year, #make, #make_date, #next_hour, #next_month, #next_year, #on_page, #random_alphanums, #random_alphanums_plus, #random_email, #random_high_ascii, #random_letters, #random_multiline, #random_nicelink, #random_string, #random_xss_string, #tomorrow, #yesterday
Methods included from PageHelper
#make, #on, #visit, #wait_until
Constructor Details
#initialize(browser, opts = {}) ⇒ AssignmentObject
Returns a new instance of AssignmentObject.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/sakai-cle-test-api/data_objects/assignment.rb', line 14 def initialize(browser, opts={}) @browser = browser defaults = { :title=>random_alphanums, :instructions=>random_multiline(250, 10, :string) } = defaults.merge(opts) @title=[:title] @instructions=[:instructions] @site=[:site] @grade_scale=[:grade_scale] @max_points=[:max_points] @allow_resubmission=[:allow_resubmission] @num_resubmissions=[:num_resubmissions] raise "You must specify a Site for your Assignment" if @site==nil raise "You must specify max points if your grade scale is 'points'" if @max_points==nil && @grade_scale=="Points" end |
Instance Attribute Details
#allow_resubmission ⇒ Object
Returns the value of attribute allow_resubmission.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/assignment.rb', line 7 def allow_resubmission @allow_resubmission end |
#description ⇒ Object
Returns the value of attribute description.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/assignment.rb', line 7 def description @description end |
#direct_url ⇒ Object
Returns the value of attribute direct_url.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/assignment.rb', line 7 def direct_url @direct_url end |
#grade_scale ⇒ Object
Returns the value of attribute grade_scale.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/assignment.rb', line 7 def grade_scale @grade_scale end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/assignment.rb', line 7 def id @id end |
#instructions ⇒ Object
Returns the value of attribute instructions.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/assignment.rb', line 7 def instructions @instructions end |
#link ⇒ Object
Returns the value of attribute link.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/assignment.rb', line 7 def link @link end |
#max_points ⇒ Object
Returns the value of attribute max_points.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/assignment.rb', line 7 def max_points @max_points end |
#num_resubmissions ⇒ Object
Returns the value of attribute num_resubmissions.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/assignment.rb', line 7 def num_resubmissions @num_resubmissions end |
#portal_url ⇒ Object
Returns the value of attribute portal_url.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/assignment.rb', line 7 def portal_url @portal_url end |
#retract_time ⇒ Object
Returns the value of attribute retract_time.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/assignment.rb', line 7 def retract_time @retract_time end |
#site ⇒ Object
Returns the value of attribute site.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/assignment.rb', line 7 def site @site end |
#status ⇒ Object
Returns the value of attribute status.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/assignment.rb', line 7 def status @status end |
#time_created ⇒ Object
Returns the value of attribute time_created.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/assignment.rb', line 7 def time_created @time_created end |
#time_due ⇒ Object
Returns the value of attribute time_due.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/assignment.rb', line 7 def time_due @time_due end |
#time_modified ⇒ Object
Returns the value of attribute time_modified.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/assignment.rb', line 7 def time_modified @time_modified end |
#title ⇒ Object Also known as: name
Returns the value of attribute title.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/assignment.rb', line 7 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/assignment.rb', line 7 def url @url end |
Instance Method Details
#create ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/sakai-cle-test-api/data_objects/assignment.rb', line 36 def create open_my_site_by_name @site unless @browser.title=~/#{@site}/ # Go to assignments page assignments unless @browser.title=~/Assignments$/ on_page AssignmentsList do |list| list.add end on_page AssignmentAdd do |add| add.title.set @title add.instructions=@instructions add.grade_scale.select @grade_scale unless @grade_scale==nil add.max_points.set @max_points unless @max_points==nil add.allow_resubmission.send(@allow_resubmission) unless @allow_resubmission==nil add.num_resubmissions.select @num_resubmissions unless @num_resubmissions==nil add.post end on_page AssignmentsList do |list| @id = list.get_assignment_id @title @link = list.assignment_href @title @status = list.status_of @title end end |
#edit(opts = {}) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/sakai-cle-test-api/data_objects/assignment.rb', line 61 def edit opts={} open_my_site_by_name @site unless @browser.title=~/#{@site}/ assignments unless @browser.title=~/Assignments$/ on AssignmentsList do |list| if @status=="Draft" list.edit_assignment "Draft - #{@title}" else list.edit_assignment @title end end on AssignmentAdd do |edit| edit.title.set opts[:title] unless opts[:title] == nil unless opts[:instructions] == nil edit.enter_source_text edit.editor, opts[:instructions] end edit.post end @title=opts[:title] unless opts[:title] == nil @instructions=opts[:instructions] unless opts[:instructions] == nil @max_points=opts[:max_points] unless opts[:title] == nil on AssignmentsList do |list| @status=list.status_of @title end end |
#get_info ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/sakai-cle-test-api/data_objects/assignment.rb', line 86 def get_info open_my_site_by_name @site unless @browser.title=~/#{@site}/ assignments unless @browser.title=~/Assignments$/ on AssignmentsList do |list| @id = list.get_assignment_id @title @status=list.status_of @title @link=list.assignment_href @title if @status=="Draft" list.open_assignment "Draft - #{@title}" else list.edit_assignment @title end end # TODO: Need to add more stuff here as needed... on AssignmentAdd do |edit| @instructions=edit.get_source_text edit.editor edit.source edit.editor edit.entity_picker(edit.editor) end on EntityPicker do |info| info.view_assignment_details @title @retract_time=info.retract_time @time_due=info.time_due @time_modified=info.time_modified @url=info.url @portal_url=info.portal_url @description=info.description @time_created=info.time_created @direct_url=info.direct_link info.close_picker end on AssignmentAdd do |edit| edit.cancel end end |