leshill / resque_spec

RSpec matcher for Resque
MIT License
295 stars 86 forks source link

resque_spec apparently not queuing anything in cucumber #16

Open ngw opened 13 years ago

ngw commented 13 years ago

Very weird problem ...

I have something working in production mode (manually testing exactly the same steps) and not working in my features, because Resque basically doesn't enqueue jobs (Resque.size is always 0).

The method that enqueues jobs is:

def generate! begin Resque.enqueue( PortfolioGenerator, id.to_s ) Rails.logger.info "\n\n#{ Resque.size( 'portfolio_generator' ) }\n\n" rescue => e Rails.logger.info "\n#{e}\n"
end end

I'm 100% sure that it gets called by cucumber (I see the output, always 0).

Here are the steps:

Before '@queue' do ResqueSpec.reset! end

When /^I upload my portfolio$/ do fill_in "portfolio[title]", :with => "Title" fill_in "portfolio[tagline]", :with => "Tagline" fill_in "portfolio[introduction]", :with => "Introduction" attach_file "portfolio[project]", File.join( Rails.root, 'spec', 'fixtures', 'fake_zip.zip' ) end

Then /^I should have enqueued a portfolio generation$/ do PortfolioGenerator.should have_queued( User.last.portfolio.id ) end

And the feature is:

Scenario: Enqueue a portfolio for generation Given I am an existing user When I follow "Generate your portfolio" And I upload my portfolio And I press "Preview" Then I should have enqueued a portfolio generation

It fails with RSpec::Expectations::ExpectationNotMetError

This is my bundle: https://gist.github.com/c91eeea75ad3f714cba1

Do you have any idea on why this happens?

leshill commented 13 years ago

Hi,

Nothing is jumping out at me. Try this:

Add a debugger statement after line #23 in lib/resque_spec/ext.rb When you run your scenario, you should hit that debugger and then walk through to see what is happening.

leshill commented 12 years ago

Hi,

Was this resolved for you?