Class: ModuleObject

Inherits:
Object
  • Object
show all
Includes:
PageHelper, Utilities, Workflows
Defined in:
lib/sakai-cle-test-api/data_objects/lesson.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 = {}) ⇒ ModuleObject

Returns a new instance of ModuleObject.



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

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

  defaults = {
    :title=>random_alphanums
  }
  options = defaults.merge(opts)

  @title=options[:title]
  @description=options[:description]
  @keywords=options[:keywords]
  @start_date=options[:start_date]
  @end_date=options[:end_date]
  @site=options[:site]
  raise "You must specify a Site name for your lesson" if @site==nil
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



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

def description
  @description
end

#end_dateObject

Returns the value of attribute end_date.



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

def end_date
  @end_date
end

#hrefObject

Returns the value of attribute href.



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

def href
  @href
end

#keywordsObject

Returns the value of attribute keywords.



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

def keywords
  @keywords
end

#siteObject

Returns the value of attribute site.



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

def site
  @site
end

#start_dateObject

Returns the value of attribute start_date.



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

def start_date
  @start_date
end

#titleObject Also known as: name

Returns the value of attribute title.



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

def title
  @title
end

Instance Method Details

#createObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/sakai-cle-test-api/data_objects/lesson.rb', line 28

def create
  open_my_site_by_name @site unless @browser.title=~/#{@site}/
  lessons unless @browser.title=~/Lessons$/
  reset
  on_page Lessons do |page|
    page.add_module
  end
  on_page AddEditModule do |page|
    page.title.set @title
    page.description.set @description
    page.keywords.set @keywords
    page.start_date.set @start_date
    page.end_date.set @end_date
    page.add
  end
  on_page ConfirmModule do |page|
    page.return_to_modules
  end
  on_page Lessons do |list|
    @href = list.href @title
  end
end