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



18
19
20
21
22
23
24
# File 'lib/easy_automation/config.rb', line 18

def initialize
  @selenium_port = 4444
  @selenium_timeout = 1000
  @browser = "Firefox"
  @url = "http://www.google.com"
  @hooks = {:before => {}, :after =>{}}
end

Instance Attribute Details

#browserObject

Returns the value of attribute browser.



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

def browser
  @browser
end

#hooksObject (readonly)

Returns the value of attribute hooks.



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

def hooks
  @hooks
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

#after(hook, &block) ⇒ Object



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

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

#before(hook, &block) ⇒ Object



26
27
28
# File 'lib/easy_automation/config.rb', line 26

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

#execute(type, hook_name) ⇒ Object



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

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

#load_files(pattern) ⇒ Object



38
39
40
41
# File 'lib/easy_automation/config.rb', line 38

def load_files pattern
  puts '888888888888 ENTRE!!!'
  Dir[pattern].each { |f| require f }
end