Sha256: 77697b139e52bfce4cd35891ce131ecb0410ba056cb03b62cdf939362d31d892

Contents?: true

Size: 1.66 KB

Versions: 3

Compression:

Stored size: 1.66 KB

Contents

require 'rack/test'

if !system("which redis-server")
  puts '', "** can't find `redis-server` in your path"
  abort ''
end

begin
  require 'simplecov'
  SimpleCov.start do
    add_filter '/spec/'
  end
  SimpleCov.coverage_dir 'coverage'
rescue LoadError
  # ignore simplecov in ruby < 1.9
end

begin
  require 'bundler'
  Bundler.setup
  Bundler.require(:default, :development)
rescue LoadError
  puts 'Bundler is not installed, you need to gem install it in order to run the specs.'
  exit 1
end

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

# Requires lib.
Dir[File.expand_path('../lib/**/*.rb', File.dirname(__FILE__))].each { |f| require f }

RSpec.configure do |config|
  # == Mock Framework
  #
  # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
  #
  # config.mock_with :mocha
  # config.mock_with :flexmock
  # config.mock_with :rr
  config.mock_with :rspec

  config.before(:suite) do
    puts "Starting redis for testing at localhost:9736..."
    `redis-server #{File.dirname(File.expand_path(__FILE__))}/redis-test.conf`
    pid = ''
    while pid.empty? do
      pid = `ps -e -o pid,command | grep [r]edis-test`.split(" ")[0]
    end
    Resque.redis = '127.0.0.1:9736'
  end

  config.before(:each) do
    Resque.redis.flushall
    Kernel.stub!(:sleep)
  end

  config.after(:suite) do
    pid = `ps -e -o pid,command | grep [r]edis-test`.split(" ")[0]
    puts '', "Killing test redis server..."
    Process.kill("KILL", pid.to_i)
    `rm -f #{File.dirname(File.expand_path(__FILE__))}/dump.rdb`
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
resque-pause-0.0.4 spec/spec_helper.rb
resque-pause-0.0.3 spec/spec_helper.rb
resque-pause-0.0.2 spec/spec_helper.rb