Sha256: eaf4a9b534ce3b55da52d8ce72f2f834390abb7a728e7ee34ee865f284ef06ce

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rspec'
require 'dynport_tools'
require "timecop"
require "ruby-debug"

if defined?(Debugger) && Debugger.respond_to?(:settings)
  Debugger.settings[:autolist] = 1
  Debugger.settings[:autoeval] = true
end

# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}

RSpec.configure do |config|
  config.include DynportTools::HaveAttributesMatcher
  config.after(:each) do
    Timecop.return
  end
end

def root
  Pathname.new(File.expand_path("../../", __FILE__))
end

def redis_pidfile
  root.join("tmp/redis.pid")
end

def redis_socket
  root.join("tmp/redis.socket")
end

redis_config = [
  "port 0",
  "unixsocket #{redis_socket}",
  "pidfile #{redis_pidfile}",
  "daemonize yes"
].join("\n")

FileUtils.mkdir_p(File.dirname(redis_pidfile))

system("echo '#{redis_config}' | redis-server -")

at_exit do
  pid = File.read(redis_pidfile).strip
  system("kill #{pid}")
  FileUtils.rm_f(redis_socket)
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dynport_tools-0.2.15 spec/spec_helper.rb
dynport_tools-0.2.14 spec/spec_helper.rb
dynport_tools-0.2.13 spec/spec_helper.rb