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

Fix pattern matching warnings on Ruby 2.7 #227

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Unreleased
---
* Add `frozen_string_literal: true` (#220)
* Fix pattern matching warnings on Ruby 2.7 (#227)

5.0.0
---
Expand Down
26 changes: 13 additions & 13 deletions lib/rspec/sidekiq/matchers/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ def initialize(klass)
def includes?(arguments, options, count)
matching = jobs.filter { |job| matches?(job, arguments, options) }

case count
in [:exactly, n]
matching.size == n
in [:at_least, n]
matching.size >= n
in [:at_most, n]
matching.size <= n
case count[0]
when :exactly
matching.size == count[1]
when :at_least
matching.size >= count[1]
when :at_most
matching.size <= count[1]
else
matching.size > 0
end
Expand Down Expand Up @@ -304,13 +304,13 @@ def prefix_message
end

def count_message
case expected_count
in [:positive, _]
case expected_count[0]
when :positive
"a"
in [:exactly, n]
n
in [relativity, n]
"#{relativity.to_s.gsub('_', ' ')} #{n}"
when :exactly
expected_count[1]
else
"#{expected_count[0].to_s.gsub('_', ' ')} #{expected_count[1]}"
end
end

Expand Down