Ravn::

SpecHelpers module

Some helper functions for testing. Usage:

# in spec/spec_helper.rb RSpec.configure do |c| c.include( Ravn::SpecHelpers ) end

Constants

DEFAULT_TEST_CONFIG

The path to the testing config file, relative to the base of the project.

HELPER_MODULES

Helper modules

LOCAL_TEST_CONFIG

The path to the local config file.

Public Class Methods

included( context )

Inclusion callback – install some hooks

# File lib/ravn/spec_helpers.rb, line 123
def self::included( context )
        if ENV['AUTOMATED_BUILD'] || ENV['CI']
                RSpec.configure do |config|
                        config.filter_run_excluding( :not_automated )
                end
        end

        super

        HELPER_MODULES.each {|mod| context.include( mod ) }
end
load_test_config( configfile=nil )

Load and install a Ravn config from the configfile specified. If no configfile is specified, it will first look for a file at the LOCAL_TEST_CONFIG. If it doesn’t exist, the DEFAULT_TEST_CONFIG will be checked. If that too doesn’t exist, then nil is passed to Ravn.load_config, which will use non-test-specific config files.

# File lib/ravn/spec_helpers.rb, line 141
def self::load_test_config( configfile=nil )
        configfile ||= ENV[ Ravn::CONFIG_ENV ]
        configfile ||= LOCAL_TEST_CONFIG if LOCAL_TEST_CONFIG.exist?
        configfile ||= DEFAULT_TEST_CONFIG if DEFAULT_TEST_CONFIG.exist?

        configfile = Pathname( configfile ) if configfile

        $stderr.puts "Loading config from: %s" % [ configfile || 'defaults' ]

        unless Ravn.config && Ravn.config.path == configfile
                Ravn.load_config( configfile )
        end
end
setup_device_id()

Alias the device ID setup method.

# File lib/ravn/spec_helpers.rb, line 157
def self::setup_device_id
        Ravn::SpecHelpers::BaseHelpers.setup_device_id
end