2011-11-04 05:12:51 +00:00
|
|
|
require "rubygems"
|
2011-11-07 07:47:23 +00:00
|
|
|
require "rspec/autorun"
|
|
|
|
|
2011-11-03 04:09:38 +00:00
|
|
|
require "log4r"
|
|
|
|
|
2011-11-09 07:03:15 +00:00
|
|
|
# Add this directory to the load path, since it just makes
|
|
|
|
# everything else so much easier.
|
|
|
|
$:.unshift File.expand_path("../", __FILE__)
|
|
|
|
|
|
|
|
# Load in the supporting files for our tests
|
|
|
|
require "support/base_context"
|
|
|
|
require "support/config"
|
|
|
|
require "support/virtualbox"
|
|
|
|
require "support/matchers/match_output"
|
2011-11-03 04:09:38 +00:00
|
|
|
|
2011-11-07 03:21:29 +00:00
|
|
|
# If VirtualBox is currently running, fail.
|
|
|
|
if Acceptance::VirtualBox.find_vboxsvc
|
|
|
|
$stderr.puts "VirtualBox must be closed and remain closed for the duration of the tests."
|
|
|
|
abort
|
|
|
|
end
|
|
|
|
|
2011-11-03 04:09:38 +00:00
|
|
|
# Enable logging if requested
|
|
|
|
if ENV["ACCEPTANCE_LOGGING"]
|
|
|
|
logger = Log4r::Logger.new("acceptance")
|
|
|
|
logger.outputters = Log4r::Outputter.stdout
|
|
|
|
logger.level = Log4r.const_get(ENV["ACCEPTANCE_LOGGING"].upcase)
|
|
|
|
logger = nil
|
|
|
|
end
|
|
|
|
|
|
|
|
# Parse the command line options and load the global configuration.
|
|
|
|
if !ENV.has_key?("ACCEPTANCE_CONFIG")
|
|
|
|
$stderr.puts "A configuration file must be passed into the acceptance test."
|
2011-11-07 03:21:29 +00:00
|
|
|
abort
|
2011-11-03 04:09:38 +00:00
|
|
|
elsif !File.file?(ENV["ACCEPTANCE_CONFIG"])
|
|
|
|
$stderr.puts "The configuration file must exist."
|
2011-11-07 03:21:29 +00:00
|
|
|
abort
|
2011-11-03 04:09:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
$acceptance_options = Acceptance::Config.new(ENV["ACCEPTANCE_CONFIG"])
|
|
|
|
|
2011-11-07 07:47:23 +00:00
|
|
|
# Configure RSpec
|
|
|
|
RSpec.configure do |c|
|
2011-11-09 07:03:15 +00:00
|
|
|
c.expect_with :rspec, :stdlib
|
2011-11-03 04:09:38 +00:00
|
|
|
end
|