spec/support/test_server.rb in riak-sessions-0.9.7 vs spec/support/test_server.rb in riak-sessions-1.0.0.beta
- old
+ new
@@ -1,16 +1,24 @@
+
require 'riak/test_server'
-unless $test_server
- begin
- require 'yaml'
- config = YAML.load_file("spec/support/test_server.yml")
- $test_server = Riak::TestServer.new(config.symbolize_keys)
- $test_server.prepare!
+RSpec.configure do |config|
+ config.before do
+ unless $test_server
+ begin
+ config = YAML.load_file("spec/support/test_server.yml")
+ $test_server = Riak::TestServer.create(:root => config['root'],
+ :source => config['source'],
+ :min_port => config['min_port'] || 15000)
+ at_exit { $test_server.stop }
+ rescue => e
+ $stderr.puts "Can't run riak-sessions specs without the test server. Specify the location of your Riak installation in spec/support/test_server.yml"
+ $stderr.puts e.inspect
+ exit 1
+ end
+ end
$test_server.start
- at_exit { $test_server.cleanup }
- rescue => e
- warn "Can't run Riak::TestServer specs. Specify the location of your Riak installation in spec/support/test_server.yml. See Riak::TestServer docs for more info."
- warn e.inspect
- $test_server = nil
+ end
+ config.after do
+ $test_server.drop
end
end