Module: Howitzer

Defined in:
lib/howitzer.rb,
lib/howitzer/log.rb,
lib/howitzer/web.rb,
lib/howitzer/cache.rb,
lib/howitzer/email.rb,
lib/howitzer/utils.rb,
lib/howitzer/version.rb,
lib/howitzer/web/page.rb,
lib/howitzer/gmail_api.rb,
lib/howitzer/exceptions.rb,
lib/howitzer/mailgun_api.rb,
lib/howitzer/web/section.rb,
lib/howitzer/mailtrap_api.rb,
lib/howitzer/web/page_dsl.rb,
lib/howitzer/mail_adapters.rb,
lib/howitzer/web/blank_page.rb,
lib/howitzer/web/iframe_dsl.rb,
lib/howitzer/web/element_dsl.rb,
lib/howitzer/web/section_dsl.rb,
lib/howitzer/capybara_helpers.rb,
lib/howitzer/gmail_api/client.rb,
lib/howitzer/web/base_section.rb,
lib/howitzer/mailgun_api/client.rb,
lib/howitzer/web/page_validator.rb,
lib/howitzer/mail_adapters/gmail.rb,
lib/howitzer/mailtrap_api/client.rb,
lib/howitzer/mailgun_api/response.rb,
lib/howitzer/mail_adapters/mailgun.rb,
lib/howitzer/mailgun_api/connector.rb,
lib/howitzer/mail_adapters/abstract.rb,
lib/howitzer/mail_adapters/mailtrap.rb,
lib/howitzer/utils/string_extensions.rb,
lib/howitzer/web/capybara_context_holder.rb,
lib/howitzer/web/capybara_methods_proxy.rb

Overview

:nocov:

Defined Under Namespace

Modules: Cache, CapybaraHelpers, GmailApi, MailAdapters, MailgunApi, MailtrapApi, Utils, Web Classes: Email, Log

Constant Summary collapse

VERSION =

:nodoc:

'2.1.1'.freeze
CommunicationError =

:nodoc:

Class.new(StandardError)
ParseError =

:nodoc:

Class.new(StandardError)
InvalidApiKeyError =

:nodoc:

Class.new(StandardError)
BadElementParamsError =

:nodoc:

Class.new(StandardError)
NoValidationError =

:nodoc:

Class.new(StandardError)
UnknownValidationError =

:nodoc:

Class.new(StandardError)
EmailNotFoundError =

:nodoc:

Class.new(StandardError)
NoAttachmentsError =

:nodoc:

Class.new(StandardError)
DriverNotSpecifiedError =

:nodoc:

Class.new(StandardError)
UnknownDriverError =

:nodoc:

Class.new(StandardError)
CloudBrowserNotSpecifiedError =

:nodoc:

Class.new(StandardError)
SelBrowserNotSpecifiedError =

:nodoc:

Class.new(StandardError)
UnknownBrowserError =

:nodoc:

Class.new(StandardError)
IncorrectPageError =

:nodoc:

Class.new(StandardError)
AmbiguousPageMatchingError =

:nodoc:

Class.new(StandardError)
NoMailAdapterError =

:nodoc:

Class.new(StandardError)
NoPathForPageError =

:nodoc:

Class.new(StandardError)
NoEmailSubjectError =

:nodoc:

Class.new(StandardError)
NoDataError =

:nodoc:

Class.new(StandardError)
UndefinedElementError =

:nodoc:

Class.new(StandardError)
UndefinedSexySettingError =

:nodoc:

Class.new(StandardError)

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.current_rake_taskObject

Returns the value of attribute current_rake_task


32
33
34
# File 'lib/howitzer.rb', line 32

def current_rake_task
  @current_rake_task
end

Class Method Details

.app_uri(name = nil) ⇒ Object

Returns an application uri for particular application name

Examples:

returns default application url with auth

app_uri.site

returns example application url with auth

app_uri(:example).site

returns default application url without auth

app_uri.origin

Parameters:

  • name (Symbol, String) (defaults to: nil)

    an application name from framework settings

Returns:

  • an application uri for particular application name


46
47
48
49
50
51
52
53
54
# File 'lib/howitzer.rb', line 46

def self.app_uri(name = nil)
  prefix = "#{name}_" if name.present?
  ::Addressable::URI.new(
    user: Howitzer.sexy_setting!("#{prefix}app_base_auth_login"),
    password: Howitzer.sexy_setting!("#{prefix}app_base_auth_pass"),
    host: Howitzer.sexy_setting!("#{prefix}app_host"),
    scheme: Howitzer.sexy_setting!("#{prefix}app_protocol") || 'http'
  )
end

.mailgun_idle_timeoutObject

Deprecated.

27
28
29
30
# File 'lib/howitzer.rb', line 27

def mailgun_idle_timeout
  puts "WARNING! 'mailgun_idle_timeout' setting is deprecated. Please replace with 'mail_wait_time' setting."
  ::SexySettings::Base.instance.all['mailgun_idle_timeout']
end

.sexy_setting!(name) ⇒ Object

Returns an setting value or raise error

Parameters:

  • name (Symbol, String)

    an setting name

Returns:

  • an setting value or raise error

Raises:


61
62
63
64
65
# File 'lib/howitzer.rb', line 61

def self.sexy_setting!(name)
  return Howitzer.public_send(name) if Howitzer.respond_to?(name)
  raise UndefinedSexySettingError,
        "Undefined '#{name}' setting. Please add the setting to config/default.yml:\n #{name}: some_value\n"
end