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

[Patch] and [Q] how to use be_processed_in #11

Closed
hiroyuki-sato opened this issue Apr 30, 2013 · 2 comments
Closed

[Patch] and [Q] how to use be_processed_in #11

hiroyuki-sato opened this issue Apr 30, 2013 · 2 comments
Assignees

Comments

@hiroyuki-sato
Copy link

Hello developer

Hello please review the following patch.
rspec-sidekiq version 0.3.0

Or could you tell me how to use be_processed_in?

Best regards.

Patch

diff --git a/lib/rspec/sidekiq/matchers/be_processed_in.rb b/lib/rspec/sidekiq/matchers/be_processed_in.rb
index ced8114..68a0095 100644
--- a/lib/rspec/sidekiq/matchers/be_processed_in.rb
+++ b/lib/rspec/sidekiq/matchers/be_processed_in.rb
@@ -19,7 +19,7 @@ module RSpec
         end

         def matches? job
-          @klass = job.class
+          @klass = job
           @actual = @klass.get_sidekiq_options["queue"]
           @actual == @expected
         end
@@ -30,4 +30,4 @@ module RSpec
       end
     end
   end
-end
\ No newline at end of file
+end

Error

I got the following error

1) MyWorker 
   Failure/Error: it { expect(MyWorker).to be_processed_in :test }
   NoMethodError:
     undefined method `get_sidekiq_options' for Class:Class

spec_file

describe MyWorker do 
  before { MyWorker.perform_async('foo', 'bar') }
  it { expect(MyWorker).to be_processed_in :test }
end
@ghost ghost assigned philostler May 1, 2013
@philostler
Copy link
Collaborator

Hi, sorry for the delay; I've been very busy lately.

Are you still having this problem?

I'm struggling to see where the problem is based on the information you've given. Have you tried copying the example on the README, as in...

describe MyWorker do
  it { should be_processed_in :test }
end

I can't accept you patch as it wouldn't work for the above example. Passing the class to RSpec creates an instance of that class in subject, hence why @klass = job.class.

Other possibles are that your worker isn't implemented correctly. Are you include the line include Sidekiq::Worker? Finally, what version of Sidekiq are you using?

Cheers, Phil

@hiroyuki-sato
Copy link
Author

Hello philostler

Thank you for your reply. I'll try and report later.

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