Skip to content

Commit

Permalink
Fix pattern matching warnings on Ruby 2.7 (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
r7kamura authored Sep 20, 2024
1 parent 854088b commit c31b54f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
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

0 comments on commit c31b54f

Please sign in to comment.