Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis not mocked in testing #18

Closed
fbjork opened this issue Jul 24, 2013 · 1 comment
Closed

Redis not mocked in testing #18

fbjork opened this issue Jul 24, 2013 · 1 comment

Comments

@fbjork
Copy link

fbjork commented Jul 24, 2013

When I add sidekiq-unique-jobs to my Rails app I noticed that Redis calls aren't stubbed during testing.

I have the following in my spec_helper.rb

require 'sidekiq/testing'
@liveh2o
Copy link

liveh2o commented Aug 12, 2013

I'm seeing the same thing. Here's a backtrace:

  7) TransactionObserver#after_destroy enqueues jobs
     Failure/Error: let(:account) { FactoryGirl.create(:account) }
     Redis::CannotConnectError:
       Error connecting to Redis on localhost:6379 (ECONNREFUSED)
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/redis-3.0.4/lib/redis/client.rb:276:in `rescue in establish_connection'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/redis-3.0.4/lib/redis/client.rb:271:in `establish_connection'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/redis-3.0.4/lib/redis/client.rb:69:in `connect'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/redis-3.0.4/lib/redis/client.rb:290:in `ensure_connected'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/redis-3.0.4/lib/redis/client.rb:177:in `block in process'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/redis-3.0.4/lib/redis/client.rb:256:in `logging'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/redis-3.0.4/lib/redis/client.rb:176:in `process'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/redis-3.0.4/lib/redis/client.rb:84:in `call'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/redis-3.0.4/lib/redis.rb:1997:in `block in watch'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/redis-3.0.4/lib/redis.rb:36:in `block in synchronize'
     # /Users/ahutchison/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/redis-3.0.4/lib/redis.rb:36:in `synchronize'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/redis-3.0.4/lib/redis.rb:1996:in `watch'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/redis-namespace-1.3.1/lib/redis/namespace.rb:317:in `method_missing'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/sidekiq-unique-jobs-2.6.6/lib/sidekiq-unique-jobs/middleware/client/unique_jobs.rb:22:in `block in call'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/connection_pool-1.1.0/lib/connection_pool.rb:49:in `with'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/sidekiq-2.13.0/lib/sidekiq.rb:67:in `redis'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/sidekiq-unique-jobs-2.6.6/lib/sidekiq-unique-jobs/middleware/client/unique_jobs.rb:20:in `call'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:111:in `block in invoke'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:114:in `call'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/sidekiq-2.13.0/lib/sidekiq/middleware/chain.rb:114:in `invoke'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/sidekiq-2.13.0/lib/sidekiq/client.rb:116:in `process_single'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/sidekiq-2.13.0/lib/sidekiq/client.rb:41:in `push'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/sidekiq-2.13.0/lib/sidekiq/worker.rb:85:in `client_push'
     # /Users/ahutchison/.rvm/gems/ruby-2.0.0-p247@abacus/gems/sidekiq-2.13.0/lib/sidekiq/worker.rb:40:in `perform_async'
     # ./app/observers/account_observer.rb:3:in `after_create'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants