Class: FolderObject

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

Returns a new instance of FolderObject.



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/sakai-cle-test-api/data_objects/resource.rb', line 47

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

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

  @name = options[:name]
  @parent_folder = options[:parent_folder]
  @site = options[:site]
  raise "You must specify a Site for your Folder" if @site==nil
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



45
46
47
# File 'lib/sakai-cle-test-api/data_objects/resource.rb', line 45

def name
  @name
end

#parent_folderObject

Returns the value of attribute parent_folder.



45
46
47
# File 'lib/sakai-cle-test-api/data_objects/resource.rb', line 45

def parent_folder
  @parent_folder
end

#siteObject

Returns the value of attribute site.



45
46
47
# File 'lib/sakai-cle-test-api/data_objects/resource.rb', line 45

def site
  @site
end

Instance Method Details

#createObject



61
62
63
64
65
66
67
68
69
70
71
# File 'lib/sakai-cle-test-api/data_objects/resource.rb', line 61

def create
  open_my_site_by_name @site unless @browser.title=~/#{@site}/
  resources unless @browser.title=~/Resources$/
  on_page Resources do |page|
    page.create_subfolders_in @parent_folder
  end
  on_page CreateFolders do |page|
    page.folder_name.set @name
    page.create_folders_now
  end
end