module Howitzer

This is main namespace for the library

:nocov:

This module holds all custom howitzer exceptions

This module holds howitzer version

:nocov:

Attributes

current_rake_task[RW]

Public Class Methods

app_uri(name = nil) click to toggle source

@return an application uri for particular application name

@param name [Symbol, String] an application name from framework settings

@example returns default application url with auth

app_uri.site

@example returns example application url with auth

app_uri(:example).site

@example returns default application url without auth

app_uri.origin
# File lib/howitzer.rb, line 85
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_timeout() click to toggle source

@deprecated

# 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
session_name() click to toggle source

@return active session name

# File lib/howitzer.rb, line 34
def session_name
  @session_name ||= 'default'
end
session_name=(name) click to toggle source

Sets new session name

@param name [String] string identifier for the session

@example Executing code in another browser Howitzer.session_name = ‘browser2’ LoginPage.on do

expect(title).to eq('Login Page')

end

# Switching back to main browser Howitzer.session_name = ‘default’

# File lib/howitzer.rb, line 51
def session_name=(name)
  @session_name = name
  Capybara.session_name = @session_name
end
sexy_setting!(name) click to toggle source

@return an setting value or raise error

@param name [Symbol, String] an setting name @raise [Howitzer::UndefinedSexySettingError] when the setting is not specified

# File lib/howitzer.rb, line 100
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
using_session(name, &block) click to toggle source

Yield a block using a specific session name

@param name [String] string identifier for the session

@example Opening page in another browser Howitzer.using_session(‘browser2’) do

LoginPage.on do
  expect(title).to eq('Login Page')
end

end

# File lib/howitzer.rb, line 67
def using_session(name, &block)
  Capybara.using_session(name, &block)
end