Skip to content

A stripped down test case of where resque_spec isn't quite working as expected

Notifications You must be signed in to change notification settings

noreaster/resque_spec_example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This a subset of my code trying to replicate the issue I was having with resque_spec. I think I have some weird configuration issue with cucumber, since it works in RSpec

Original Post:

I'm not quite sure what I'm doing wrong. I can get enqueue_at to work in RSpec, but not cucumber.

Resque.enqueue works properly in cucumber (and RSpec) but I always get "Invalid argument - connect(2) (Errno::EINVAL)" when I try to run Resque.enqueue_at in cucumber

.env

require 'rubygems'
require 'spork'

Spork.prefork do
  require 'resque_spec/cucumber'
  require 'resque_spec/scheduler'
end

phone_poll_steps.rb (doesn't work)

When(/^It is time to be called$/) do

  PhonePollTaker.should have_schedule_size_of(0)
  Resque.enqueue_at(DateTime.now + 2.seconds, PhonePollTaker,  1) # line that fails
  PhonePollTaker.should have_schedule_size_of(1)
end

phone_poll_spec.rb (works)

describe PhonePoll do
  it 'should be able to make a call' do
    ...
    PhonePollTaker.should have_schedule_size_of(0)
    Resque.enqueue_at(DateTime.now + 2.seconds, PhonePollTaker,  1)
    PhonePollTaker.should have_schedule_size_of(1)
  end
end

Works in both

  Resque.enqueue(PhonePollTaker,  1)

Since the original post I've changed .env to

require 'rubygems'
require 'spork'
require 'resque_spec/cucumber'
require 'resque_spec/scheduler'

Spork.prefork do
end

About

A stripped down test case of where resque_spec isn't quite working as expected

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published