Class: AnnouncementObject
- Inherits:
-
Object
- Object
- AnnouncementObject
- Includes:
- PageHelper, Utilities, Workflows
- Defined in:
- lib/sakai-cle-test-api/data_objects/announcement.rb
Instance Attribute Summary collapse
-
#access ⇒ Object
Returns the value of attribute access.
-
#availability ⇒ Object
Returns the value of attribute availability.
-
#body ⇒ Object
Returns the value of attribute body.
-
#creation_date ⇒ Object
Returns the value of attribute creation_date.
-
#date ⇒ Object
Returns the value of attribute date.
-
#groups ⇒ Object
Returns the value of attribute groups.
-
#id ⇒ Object
Returns the value of attribute id.
-
#link ⇒ Object
Returns the value of attribute link.
-
#message ⇒ Object
Returns the value of attribute message.
-
#message_html ⇒ Object
Returns the value of attribute message_html.
-
#saved_by ⇒ Object
Returns the value of attribute saved_by.
-
#site ⇒ Object
Returns the value of attribute site.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#title ⇒ Object
(also: #name)
Returns the value of attribute title.
Instance Method Summary collapse
- #create ⇒ Object
- #edit(opts = {}) ⇒ Object
-
#initialize(browser, opts = {}) ⇒ AnnouncementObject
constructor
A new instance of AnnouncementObject.
- #view ⇒ Object
Methods included from Workflows
menu_link, #open_my_site_by_name
Methods included from PageHelper
#make, #on, #visit, #wait_until
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
Constructor Details
#initialize(browser, opts = {}) ⇒ AnnouncementObject
Returns a new instance of AnnouncementObject.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/sakai-cle-test-api/data_objects/announcement.rb', line 11 def initialize(browser, opts={}) @browser = browser defaults = { :title=>random_alphanums, :body=>random_multiline(500, 10, :alpha) } = defaults.merge(opts) @title=[:title] @body=[:body] @site=[:site] raise "You must specify a Site for the announcement" if @site==nil end |
Instance Attribute Details
#access ⇒ Object
Returns the value of attribute access.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/announcement.rb', line 7 def access @access end |
#availability ⇒ Object
Returns the value of attribute availability.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/announcement.rb', line 7 def availability @availability end |
#body ⇒ Object
Returns the value of attribute body.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/announcement.rb', line 7 def body @body end |
#creation_date ⇒ Object
Returns the value of attribute creation_date.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/announcement.rb', line 7 def creation_date @creation_date end |
#date ⇒ Object
Returns the value of attribute date.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/announcement.rb', line 7 def date @date end |
#groups ⇒ Object
Returns the value of attribute groups.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/announcement.rb', line 7 def groups @groups end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/announcement.rb', line 7 def id @id end |
#link ⇒ Object
Returns the value of attribute link.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/announcement.rb', line 7 def link @link end |
#message ⇒ Object
Returns the value of attribute message.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/announcement.rb', line 7 def @message end |
#message_html ⇒ Object
Returns the value of attribute message_html.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/announcement.rb', line 7 def @message_html end |
#saved_by ⇒ Object
Returns the value of attribute saved_by.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/announcement.rb', line 7 def saved_by @saved_by end |
#site ⇒ Object
Returns the value of attribute site.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/announcement.rb', line 7 def site @site end |
#subject ⇒ Object
Returns the value of attribute subject.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/announcement.rb', line 7 def subject @subject end |
#title ⇒ Object Also known as: name
Returns the value of attribute title.
7 8 9 |
# File 'lib/sakai-cle-test-api/data_objects/announcement.rb', line 7 def title @title end |
Instance Method Details
#create ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/sakai-cle-test-api/data_objects/announcement.rb', line 27 def create open_my_site_by_name @site unless @browser.title=~/#{@site}/ announcements unless @browser.title=~/Announcements$/ on_page Announcements do |page| page.add end on_page AddEditAnnouncements do |page| page.title.set @title page.enter_source_text page.editor, @body page.add_announcement @creation_date=make_date Time.now end on_page Announcements do |page| @link = page.href(@title) @id = @link[/(?<=msg\/).+(?=\/main\/)/] end end |
#edit(opts = {}) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/sakai-cle-test-api/data_objects/announcement.rb', line 45 def edit opts={} open_my_site_by_name @site unless @browser.title=~/#{@site}/ announcements unless @browser.title=~/Announcements$/ on_page Announcements do |list| list.edit @title end on AddEditAnnouncements do |edit| edit.title.set opts[:title] unless opts[:title]==nil edit.send(opts[:access]) unless opts[:access]==nil edit.send(opts[:availability]) unless opts[:availability]==nil unless opts[:body]==nil edit.enter_source_text edit.editor, opts[:body] end edit.save_changes end @title=opts[:title] unless opts[:title]==nil @body=opts[:body] unless opts[:body]==nil @access=opts[:access] @availability=opts[:availability] end |
#view ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/sakai-cle-test-api/data_objects/announcement.rb', line 66 def view open_my_site_by_name @site unless @browser.title=~/#{@site}/ announcements unless @browser.title=~/Announcements$/ on Announcements do |list| list.view @title end on ViewAnnouncement do |view| @subject=view.subject @saved_by=view.saved_by @date=view.date @groups=view.groups @message=view. @message_html=view. end end |