Module: Gless

Defined in:
lib/gless.rb,
lib/gless/config.rb,
lib/gless/logger.rb,
lib/gless/browser.rb,
lib/gless/session.rb,
lib/gless/base_page.rb,
lib/gless/wrap_watir.rb

Overview

The Gless module itself only defines a setup method; all the meat is in the other classes, especially Session. See the README for a general overview; it lives at github.com/rlpowell/gless , which is also the home of this project.

Defined Under Namespace

Classes: BasePage, Browser, EnvConfig, Logger, Session, WrapWatir

Constant Summary collapse

VERSION =

The current version number.

'1.4.2'

Class Method Summary collapse

Class Method Details

.setup(tag) {|config| ... } ⇒ Gless::Logger, ...

Sets up the config, logger and browser instances, the ordering of which is slightly tricky. If a block is given, the config, after being initialized from the config file, is passed to the block, which should return the new, updated config.

Yields:

  • (config)

    The config loaded from the development file. The optional block should return an updated config if given.

Returns:



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/gless.rb', line 20

def self.setup( tag )
  logger = Gless::Logger.new( tag )

  # Create the config reading/storage object
  config = Gless::EnvConfig.new( )
  config = yield config if block_given?

  # Get the whole backtrace, please.
  if config.get :global, :debug
    ::Cucumber.use_full_backtrace = true

    ::RSpec.configure do |config|
      # RSpec automatically cleans stuff out of backtraces;
      # sometimes this is annoying when trying to debug something e.g. a gem
      config.backtrace_clean_patterns = []
    end
  end

  # Turn on verbose (info) level logging.
  if config.get :global, :verbose
    logger.normal_log.level = ::Logger::INFO
    logger.replay_log.level = ::Logger::INFO
    logger.debug "Verbose/info level logging enabled."
  end

  # Turn on debug level logging.
  if config.get :global, :debug
    logger.normal_log.level = ::Logger::DEBUG
    logger.replay_log.level = ::Logger::DEBUG
    logger.debug "Debug level logging enabled."
  end

  # Create the browser.
  browser = Gless::Browser.new( config, logger )
  browser.cookies.clear

  return logger, config, browser
end