Sha256: 19eb01aa38a0f80b57e3b0617faf275fb1c36801408323a9fb7b50b5099dcb09

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

require 'riak/test_server'
require 'singleton'

module Ripple
  # 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 TestServer < Riak::TestServer
    include Singleton

    # Creates and starts the test server
    def self.setup
      instance.create
      instance.start
    end

    # Clears data from the test server
    def self.clear
      instance.drop
    end

    # @private
    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
  end
end

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
wyngle-ripple-0.1.0 lib/ripple/test_server.rb
better-ripple-1.0.0 lib/ripple/test_server.rb
ripple-1.0.0.beta2 lib/ripple/test_server.rb