Class: SyllabusObject

Inherits:
Object
  • Object
show all
Includes:
PageHelper, Utilities, Workflows
Defined in:
lib/sakai-cle-test-api/data_objects/syllabus.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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 = {}) ⇒ SyllabusObject

Returns a new instance of SyllabusObject.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/sakai-cle-test-api/data_objects/syllabus.rb', line 9

def initialize(browser, opts={})
  @browser = browser

  defaults = {
      :title=>random_alphanums,
      :content=>random_multiline(50, 5, :alpha)
  }
  options = defaults.merge(opts)
  @title=options[:title]
  @content=options[:content]
  @site=options[:site]
  raise "You must specify a Site for the announcement" if @site==nil
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



7
8
9
# File 'lib/sakai-cle-test-api/data_objects/syllabus.rb', line 7

def content
  @content
end

#siteObject

Returns the value of attribute site.



7
8
9
# File 'lib/sakai-cle-test-api/data_objects/syllabus.rb', line 7

def site
  @site
end

#titleObject Also known as: name

Returns the value of attribute title.



7
8
9
# File 'lib/sakai-cle-test-api/data_objects/syllabus.rb', line 7

def title
  @title
end

Instance Method Details

#createObject



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/sakai-cle-test-api/data_objects/syllabus.rb', line 25

def create
  open_my_site_by_name @site unless @browser.title=~/#{@site}/
  syllabus unless @browser.title=~/Syllabus$/
  on Syllabus do |add|
    add.create_edit
    add.add
  end
  on AddEditSyllabusItem do |create|
    create.title.set @title
    create.enter_source_text create.editor, @content
    create.post
  end
end