Class: EasyAutomation::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/easy_automation/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Default settings for selenium RC



21
22
23
24
25
26
27
# File 'lib/easy_automation/config.rb', line 21

def initialize
  @browsers = []
  @selenium_port = 4444
  @selenium_timeout = 4000
  @url = "http://www.google.com"
  @hooks = {:before => {}, :after =>{}}
end

Instance Attribute Details

#browsersObject

Returns the value of attribute browsers.



14
15
16
# File 'lib/easy_automation/config.rb', line 14

def browsers
  @browsers
end

#current_browserObject

Returns the value of attribute current_browser.



13
14
15
# File 'lib/easy_automation/config.rb', line 13

def current_browser
  @current_browser
end

#hooksObject (readonly)

Returns the value of attribute hooks.



15
16
17
# File 'lib/easy_automation/config.rb', line 15

def hooks
  @hooks
end

#selenium_hostObject

Returns the value of attribute selenium_host.



11
12
13
# File 'lib/easy_automation/config.rb', line 11

def selenium_host
  @selenium_host
end

#selenium_portObject

Returns the value of attribute selenium_port.



9
10
11
# File 'lib/easy_automation/config.rb', line 9

def selenium_port
  @selenium_port
end

#selenium_timeoutObject

Returns the value of attribute selenium_timeout.



10
11
12
# File 'lib/easy_automation/config.rb', line 10

def selenium_timeout
  @selenium_timeout
end

#urlObject

Returns the value of attribute url.



12
13
14
# File 'lib/easy_automation/config.rb', line 12

def url
  @url
end

Instance Method Details

#add_browser(browser) ⇒ Object



33
34
35
# File 'lib/easy_automation/config.rb', line 33

def add_browser browser
  @browsers << browser
end

#after(hook, &block) ⇒ Object



49
50
51
# File 'lib/easy_automation/config.rb', line 49

def after hook, &block
  @hooks[:after].merge!({hook.to_sym => block}) if block_given?
end

#before(hook, &block) ⇒ Object



45
46
47
# File 'lib/easy_automation/config.rb', line 45

def before hook, &block
  @hooks[:before].merge!({hook.to_sym => block}) if block_given?
end

#browser=(browser) ⇒ Object



29
30
31
# File 'lib/easy_automation/config.rb', line 29

def browser=(browser)
  @browsers = [browser]
end

#execute(type, hook_name) ⇒ Object



53
54
55
# File 'lib/easy_automation/config.rb', line 53

def execute type, hook_name
  @hooks[type.to_sym][hook_name.to_sym].call if @hooks[type.to_sym][hook_name.to_sym]
end