Sha256: 54bcb477bd71a61e9a213d8441a55febbfef6e19cff089a235404606627fa762

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

require 'rspec-system'
require 'yaml'
require 'pp'
require 'tempfile'

RSpec.configure do |c|
  include RSpecSystem::Log

  def nodeset
    Pathname.new(File.join(File.basename(__FILE__), '..', '.nodeset.yml'))
  end

  def rspec_system_config
    YAML.load_file('.nodeset.yml')
  end

  # Grab the type of virtual environment we wish to run these tests in
  def rspec_virtual_env
    ENV["RSPEC_VIRTUAL_ENV"] || 'vagrant'
  end

  def rspec_system_node_set
    setname = ENV['RSPEC_SET'] || rspec_system_config['default_set']
    config = rspec_system_config['sets'][setname]
    RSpecSystem::NodeSet.create(setname, config, rspec_virtual_env)
  end

  c.system_tmp = Dir.tmpdir
  c.before :suite do
    log.info "START RSPEC-SYSTEM SETUP"
    log.info "Setname is: " + rspec_system_node_set.setname
    log.info "Configuration is: " + rspec_system_node_set.config.pretty_inspect
    log.info "Virtual Environment type is: #{rspec_system_node_set.env_type}"

    rspec_system_node_set.setup
  end

  c.after :suite do
    log.info 'FINALIZE RSPEC-SYSTEM SETUP'
    rspec_system_node_set.teardown
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-system-0.0.2 lib/rspec-system/spec_helper.rb