Comments (11)
That's a new one on me.
I'd try rolling out rspec-sidekiq
and just adding require "sidekiq/testing"
into your spec_helper.rb
and see if it's the vanilla Sidekiq testing class that's causing problems
from rspec-sidekiq.
Unfortunately that's not it, rspec runs with either require 'sidekiq/testing'
or require 'sidekiq/testing/inline'
. In both cases I get undefined method has_enqueued_job?
which is totally expected as rspec-sidekiq
isn't installed. I am doing this within an engine which may be an issue. I'll try in a clean app and see.
from rspec-sidekiq.
OK cheers, let me know if that's it. I'll take a look when I get time to see if something has broken the gem in the latest version of Sidekiq
from rspec-sidekiq.
Well now I'm stumped! A new Rails 4RC1 app, SideKiq, Rspec and Rspec-SideKiq all work fine.
I went back to my engine where I have add_dependency "sidekiq", "~> 2.11.2"
in my gemspec, and moved it to gem 'sidekiq'
in the Gemfile, bundling and voila the specs pass without errors. Moving it back, bundling and I get the same error as before.
I also went though removing a bunch of other gems like Spork and Cucumber to isolate the issue but they seamed to have no effect.
from rspec-sidekiq.
I've not taken a further look at this yet... you had chance to dive any deeper?
from rspec-sidekiq.
I haven't investigated past the fact that it works with Sidekiq in the Gemfile but not in the Gemspec. My only guess is something additional needs to be required somewhere as a result but I don't know Sidekiq well enough to know what.
from rspec-sidekiq.
Do you have a dummy project setup where I can quick reproduce this?
from rspec-sidekiq.
Scratch that, I managed to reproduce this while testing the gem itself. It's simply that Sidekiq needs to be required somewhere (whether that's by Bundler or require sidekiq
).
When adding a dependency in the gemspec Bundler does not require it for you so you must do that yourself (in my case in the spec_helper.rb
).
There's a Stack Overflow thread here about it.... http://stackoverflow.com/questions/15721474/how-do-i-get-rspec-to-read-the-dependencies-in-my-gemspec
from rspec-sidekiq.
Figured out the same thing myself in putting together a sample app. Thanks for the help and interest, great project!
from rspec-sidekiq.
Hi,
I have the same problem and cannot manage to resolve it.
I am on ruby 2.0.0 (and tested with 1.9.3), running sidekiq (2.13.0) with rspec-sidekiq (0.4.0) and rspec-rails (2.14.0).
The error message is : sidekiq-2.13.0/lib/sidekiq/testing.rb:7:in 'alias_method': undefined method 'raw_push' for class 'Class' (NameError)
Gemfile
:
group :test do
gem 'rspec-rails'
gem 'rspec-sidekiq'
end
spec_helper.rb
:
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'sidekiq'
require 'sidekiq/testing'
require 'rspec/rails'
require 'rspec/autorun'
from rspec-sidekiq.
This must be the same issue as has been discussed in this thread already (Sidekiq not being required properly).
I primarily use a Sinatra setup so within my spec_helper.rb
I have this...
require "bundler"
Bundler.require(:default, ENV["RACK_ENV"].to_sym)
...to perform my requires for me.
The only thing I can think of off the top of my head is ensure that you require sidekiq
before rspec-sidekiq
is required.
from rspec-sidekiq.
Related Issues (20)
- have_enqueued_sidekiq_job Diff is Wrong HOT 4
- Testing the negative case of have_enqueued_sidekiq_job with any arguments? HOT 10
- be_retryable not using global settings HOT 2
- Checking for time has a different format expectation HOT 1
- has_enqueued_sidekiq_job is not matching even though they are identical HOT 7
- Disable all sidekiq jobs for testing HOT 1
- Block syntax `enqueue_sidekiq_job` matcher HOT 8
- Issue with yaml safe loading (psych gem) HOT 2
- `be_delayed` without expected_arguments never matches HOT 4
- RSpec::Sidekiq::NullStatus is missing pending count
- Using ActiveJob::Base with sidekiq_options raises an error HOT 5
- difference in DST handling between Sidekiq's `perform_in` and `have_enqueued_sidekiq_job`
- How to expect to have_enqueued_sidekiq_job with specific queue? - [setting queue name at runtime] HOT 1
- Does this gem need a new owner? HOT 17
- Null Object method missing for Null Batch masks NoMethod errors
- Support Sidekiq 7 and deprecate be_delayed matcher
- Potentially unintentional breaking change in 4.0 with Symbol in argument matchers? HOT 15
- Potentially unintentional breaking change in 4.0.2 with Symbol in argument matchers? (Part 2) HOT 6
- NameError: uninitialized constant RSpec::Matchers::Composable HOT 5
- Match on custom context HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rspec-sidekiq.