Top Level Namespace
- Includes:
- DataGenerator
Defined Under Namespace
Modules: CapybaraPatched, CapybaraSettings, DataGenerator, Howitzer, LocatorStore, MailgunHelper, Rawler Classes: Email, MailClient, Mailbox, Mailgun, MailgunMessage, MailgunResource, Route, String, WebPage
Constant Summary collapse
- DriverNotSpecified =
Class.new(StandardError)
- SlBrowserNameNotSpecified =
Class.new(StandardError)
- TbBrowserNameNotSpecified =
Class.new(StandardError)
- SelBrowserNotSpecified =
Class.new(StandardError)
- CHECK_YOUR_SETTINGS_MSG =
"Please check your settings"
- DRIVER_NOT_SPECIFIED =
DriverNotSpecified.new(CHECK_YOUR_SETTINGS_MSG)
- SL_BROWSER_NAME_NOT_SPECIFIED =
SlBrowserNameNotSpecified.new(CHECK_YOUR_SETTINGS_MSG)
- TB_BROWSER_NAME_NOT_SPECIFIED =
TbBrowserNameNotSpecified.new(CHECK_YOUR_SETTINGS_MSG)
- SEL_BROWSER_NOT_SPECIFIED =
SelBrowserNotSpecified.new(CHECK_YOUR_SETTINGS_MSG)
Instance Method Summary collapse
-
#app_base_url(prefix = nil) ⇒ Object
Returns application url without base authentication by default.
-
#app_url ⇒ Object
Returns application url including base authentication (if specified in settings).
- #chrome_browser? ⇒ Boolean
-
#duration(time_in_numeric) ⇒ Object
Parameters: *
time_in_numeric
- Number of seconds. - #ff_browser? ⇒ Boolean
- #ie_browser? ⇒ Boolean
-
#log ⇒ Object
Returns logger as singleton object.
-
#ri(value) ⇒ Object
Evaluates given value.
- #sauce_driver? ⇒ Boolean
- #selenium_driver? ⇒ Boolean
-
#settings ⇒ Object
Returns settings as singleton object.
- #testingbot_driver? ⇒ Boolean
Instance Method Details
#app_base_url(prefix = nil) ⇒ Object
Returns application url without base authentication by default
Parameters:
-
prefix
- Sets base authentication prefix (defaults to: nil)
87 88 89 |
# File 'lib/howitzer/helpers.rb', line 87 def app_base_url(prefix=nil) "#{settings.app_protocol || 'http'}://#{prefix}#{settings.app_host}" end |
#app_url ⇒ Object
Returns application url including base authentication (if specified in settings)
75 76 77 78 |
# File 'lib/howitzer/helpers.rb', line 75 def app_url prefix = settings.app_base_auth_login.blank? ? '' : "#{settings.app_base_auth_login}:#{settings.app_base_auth_pass}@" app_base_url prefix end |
#chrome_browser? ⇒ Boolean
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/howitzer/helpers.rb', line 55 def chrome_browser? chrome_browser = :chrome if sauce_driver? raise SL_BROWSER_NAME_NOT_SPECIFIED if settings.sl_browser_name.nil? settings.sl_browser_name.to_sym == chrome_browser elsif testingbot_driver? raise TB_BROWSER_NAME_NOT_SPECIFIED if settings.tb_browser_name.nil? settings.tb_browser_name.to_sym == chrome_browser elsif selenium_driver? raise SEL_BROWSER_NOT_SPECIFIED if settings.sel_browser.nil? settings.sel_browser.to_sym == chrome_browser end end |
#duration(time_in_numeric) ⇒ Object
Parameters:
-
time_in_numeric
- Number of seconds
95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/howitzer/helpers.rb', line 95 def duration(time_in_numeric) secs = time_in_numeric.to_i mins = secs / 60 hours = mins / 60 if hours > 0 "[#{hours}h #{mins % 60}m #{secs % 60}s]" elsif mins > 0 "[#{mins}m #{secs % 60}s]" elsif secs >= 0 "[0m #{secs}s]" end end |
#ff_browser? ⇒ Boolean
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/howitzer/helpers.rb', line 40 def ff_browser? ff_browsers = [:ff, :firefox] if sauce_driver? raise SL_BROWSER_NAME_NOT_SPECIFIED if settings.sl_browser_name.nil? ff_browsers.include?(settings.sl_browser_name.to_sym) elsif testingbot_driver? raise TB_BROWSER_NAME_NOT_SPECIFIED if settings.tb_browser_name.nil? ff_browsers.include?(settings.tb_browser_name.to_sym) elsif selenium_driver? raise SEL_BROWSER_NOT_SPECIFIED if settings.sel_browser.nil? ff_browsers.include?(settings.sel_browser.to_sym) end end |
#ie_browser? ⇒ Boolean
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/howitzer/helpers.rb', line 26 def ie_browser? ie_browsers = [:ie, :iexplore] if sauce_driver? raise SL_BROWSER_NAME_NOT_SPECIFIED if settings.sl_browser_name.nil? ie_browsers.include?(settings.sl_browser_name.to_sym) elsif testingbot_driver? raise TB_BROWSER_NAME_NOT_SPECIFIED if settings.tb_browser_name.nil? ie_browsers.include?(settings.tb_browser_name.to_sym) elsif selenium_driver? raise SEL_BROWSER_NOT_SPECIFIED if settings.sel_browser.nil? ie_browsers.include?(settings.sel_browser.to_sym) end end |
#log ⇒ Object
Returns logger as singleton object
25 26 27 |
# File 'lib/howitzer/settings.rb', line 25 def log Howitzer::Log.instance end |
#ri(value) ⇒ Object
Evaluates given value
Parameters:
-
value
- Value to be evaluated
116 117 118 |
# File 'lib/howitzer/helpers.rb', line 116 def ri(value) raise value.inspect end |
#sauce_driver? ⇒ Boolean
11 12 13 14 |
# File 'lib/howitzer/helpers.rb', line 11 def sauce_driver? raise DRIVER_NOT_SPECIFIED if settings.driver.nil? settings.driver.to_sym == :sauce end |
#selenium_driver? ⇒ Boolean
21 22 23 24 |
# File 'lib/howitzer/helpers.rb', line 21 def selenium_driver? raise DRIVER_NOT_SPECIFIED if settings.driver.nil? settings.driver.to_sym == :selenium end |
#settings ⇒ Object
Returns settings as singleton object
Example:
settings.app_host
16 17 18 |
# File 'lib/howitzer/settings.rb', line 16 def settings SexySettings::Base.instance end |
#testingbot_driver? ⇒ Boolean
16 17 18 19 |
# File 'lib/howitzer/helpers.rb', line 16 def testingbot_driver? raise DRIVER_NOT_SPECIFIED if settings.driver.nil? settings.driver.to_sym == :testingbot end |