spec/support/test_server.rb in ripple-0.9.5 vs spec/support/test_server.rb in ripple-1.0.0.beta
- old
+ new
@@ -1,17 +1,27 @@
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(:each, :integration => true) do
+ unless $test_server
+ begin
+ require 'yaml'
+ 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
+ pending("Can't run ripple integration specs without the test server. Specify the location of your Riak installation in spec/support/test_server.yml\n#{e.inspect}")
+ end
+ end
+ Ripple.config = {
+ :http_port => $test_server.http_port,
+ :pb_port => $test_server.pb_port
+ }
$test_server.start
- Ripple.config = {:http_port => 9000 }
- 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(:each, :integration => true) do
+ $test_server.drop
end
end