module Howitzer
This is main namespace for the library
:nocov:
This module holds all custom howitzer exceptions
This module holds howitzer version
:nocov:
Attributes
Public Class Methods
@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
@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
@return active session name
# File lib/howitzer.rb, line 34 def session_name @session_name ||= 'default' end
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
@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
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