Sha256: bda2fa07fc9d0af5f0ee22b7b5a8f8ef29a4b858eb03437e9a13dc916a0e1904

Contents?: true

Size: 985 Bytes

Versions: 5

Compression:

Stored size: 985 Bytes

Contents

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

# 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

5 entries across 5 versions & 1 rubygems

Version Path
dynport_tools-0.2.12 spec/spec_helper.rb
dynport_tools-0.2.11 spec/spec_helper.rb
dynport_tools-0.2.10 spec/spec_helper.rb
dynport_tools-0.2.9 spec/spec_helper.rb
dynport_tools-0.2.8 spec/spec_helper.rb