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

validate_worker! throws error #466

Closed
sharq1 opened this issue Jan 22, 2020 · 4 comments · Fixed by #477
Closed

validate_worker! throws error #466

sharq1 opened this issue Jan 22, 2020 · 4 comments · Fixed by #477

Comments

@sharq1
Copy link

sharq1 commented Jan 22, 2020

Describe the bug
Testing using minitest and when calling validate_worker! I get an error. Test includes only this single line:

assert SidekiqUniqueJobs.validate_worker!(EntityUserRefreshCacheWorker.get_sidekiq_options)

I don't require any of your test-related libs as it looks to me they're meant only for Rspec, as tests exit immediately with an error when I include require "sidekiq_unique_jobs/testing":
/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sidekiq-unique-jobs-7.0.0.beta9/lib/sidekiq_unique_jobs/rspec/matchers.rb:17:in `<top (required)>': uninitialized constant RSpec (NameError)

Expected behavior
Assertion would pass/fail.

Current behavior
Getting an error:
NameError: uninitialized constant SidekiqUniqueJobs::Lock::BaseLock::Validator

Worker class

module AssignmentJobs
  class EntityUserRefreshCacheWorker
    include Sidekiq::Worker
    sidekiq_options queue: 'low', lock: :until_and_while_executing

    def perform(user_id, klass_name)
      user = User.find_by_id(user_id)
      return if user.nil?
      user.assignment.refresh(klass_name)
    end
  end
end

Additional context
Using 7.0.0.beta9 version with minitest v 5.10.3. I also require the 'sidekiq/testing' in global tests config.

Also I love the gem overall, great job!

@mhenrixon
Copy link
Owner

HAH! I obviously forgot that some people are not even using RSpec to test their code :)

Thanks for the reminder, I'll try and get a fix for this sometime this week.

@sharq1
Copy link
Author

sharq1 commented Jan 22, 2020

Wow, that's a fast response... Thank you!

@mhenrixon
Copy link
Owner

The fix while simple unfortunately took a while. Released as v7.0.0.beta11 a few minutes ago @sharq1

@sharq1
Copy link
Author

sharq1 commented Mar 21, 2020

Thank you very much!

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

Successfully merging a pull request may close this issue.

2 participants