Ravn::SpecHelpers::

BdeHelpers module

A collection of test helper functions and classes.

Public Class Methods

included( context )

Inclusion callback – install some hooks

# File lib/ravn/spec_helpers/bde_helpers.rb, line 21
def self::included( context )

        # :TODO: Make this conditional on a :tmp_mission_dir spec option?
        context.around( :each ) do |example|
                Ravn::SpecHelpers::BdeHelpers.with_temp_mission_dir( example )
                Ravn::BDE.reset
        end

end

Public Instance Methods

with_temp_mission_dir( example )

Run the specified example with the mission directory set to a tmpdir, cleaning it up when the example is done.

# File lib/ravn/spec_helpers/bde_helpers.rb, line 38
def with_temp_mission_dir( example )
        Dir.mktmpdir( ['ravn', 'spec'] ) do |dir|
                Ravn::SpecHelpers::BdeHelpers.log.info "Test mission directory is: %p" % [ dir ]
                @test_mission_dir = dir
                Ravn::BDE.mission_directory = dir

                example.run
        end
end