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-12-11 23:53:11 +00:00
|
|
|
# Add the test directory to the load path
|
2011-12-04 03:05:50 +00:00
|
|
|
$:.unshift File.expand_path("../../", __FILE__)
|
2011-11-09 07:03:15 +00:00
|
|
|
|
|
|
|
# Load in the supporting files for our tests
|
2011-12-11 23:53:11 +00:00
|
|
|
require "acceptance/support/shared/base_context"
|
|
|
|
require "acceptance/support/config"
|
|
|
|
require "acceptance/support/virtualbox"
|
|
|
|
require "acceptance/support/matchers/match_output"
|
2011-12-23 05:46:43 +00:00
|
|
|
require "acceptance/support/matchers/succeed"
|
2011-11-03 04:09:38 +00:00
|
|
|
|
2011-11-27 18:16:24 +00:00
|
|
|
# Do not buffer output
|
|
|
|
$stdout.sync = true
|
|
|
|
$stderr.sync = true
|
|
|
|
|
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
|
2011-12-22 21:38:30 +00:00
|
|
|
if ENV["ACCEPTANCE_LOG"]
|
2011-12-25 06:25:02 +00:00
|
|
|
logger = Log4r::Logger.new("test")
|
2011-11-03 04:09:38 +00:00
|
|
|
logger.outputters = Log4r::Outputter.stdout
|
2011-12-22 21:38:30 +00:00
|
|
|
logger.level = Log4r.const_get(ENV["ACCEPTANCE_LOG"].upcase)
|
2011-11-03 04:09:38 +00:00
|
|
|
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
|