Skip to content

Enqueue_at works in RSpec but not Cucumber step #103

@noreaster

Description

@noreaster

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions