Class: Ripple::TestServer

Inherits:
Riak::TestServer
  • Object
show all
Includes:
Singleton
Defined in:
lib/ripple/test_server.rb

Overview

Extends the Riak::TestServer to be aware of the Ripple configuration and adjust settings appropriately. Also simplifies its usage in the generation of test helpers.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = Ripple.config.dup) ⇒ TestServer

Returns a new instance of TestServer.



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ripple/test_server.rb', line 23

def initialize(options=Ripple.config.dup)
  options[:env] ||= {}
  options[:env][:riak_kv] ||= {}
  options[:env][:riak_kv][:js_source_dir] ||= Ripple.config.delete(:js_source_dir)
  options[:env][:riak_kv][:map_cache_size] ||= 0
  options[:env][:riak_core] ||= {}
  options[:env][:riak_core][:http] ||= [ Tuple[Ripple.config[:host], Ripple.config[:http_port]] ]
  options[:env][:riak_kv][:pb_port] ||= Ripple.config[:pb_port]
  options[:env][:riak_kv][:pb_ip] ||= Ripple.config[:host]
  super(options)
end

Class Method Details

.clearObject

Clears data from the test server



18
19
20
# File 'lib/ripple/test_server.rb', line 18

def self.clear
  instance.drop
end

.setupObject

Creates and starts the test server



12
13
14
15
# File 'lib/ripple/test_server.rb', line 12

def self.setup
  instance.create
  instance.start
end