rspec-sidekiq 4.0.0 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb94abca8e805aa88d9c84deb0ddb22746542845b48cde790c4da9ae58f48ca0
4
- data.tar.gz: 646f1ee2cc023cd988f29b50250c6794cb7563a78c35a397f1f3290cbf9df97b
3
+ metadata.gz: cb2a5b25d191b39f3f9a8780b01c04c635e1218b9c0079fdc993d5069a43129b
4
+ data.tar.gz: a5cd5585a407a4d40f9e31643f5ee5ab14839d80bbdf8cf2bcbb9dd30104bfd0
5
5
  SHA512:
6
- metadata.gz: 0d0b4a026d3e28f55e03076023b83eb11334cd2759514837f0fd37ce74d01279bf0aa53236e84185eb89e949ad429f21c40e09d1858c5a0beb622f5001617311
7
- data.tar.gz: 42c83b796648b68262a689f6fabe441719347e9464505ca4ade74ebab9cad748e51896af223b441adda74fe9b6300cb9ecb1f1974843fa45cf225dcbefc996ca
6
+ metadata.gz: 773e7f3b63d3ad5165ccff805c54040905e42e3769bde2e1605d1e4620024dfcd39b8bd1aac5691b91efd0e70ea38f4f72a7af97ebf75f60930dd5b498c0c7ec
7
+ data.tar.gz: 75072507499d9c8835c039e5175b6672a2f184f080f260dad3fe02a53d995efa8a16f5ad07252fa97d6a7e0eb6ee86e10fdfca3189bbbd89c638d4327188b9ce
data/CHANGES.md CHANGED
@@ -1,3 +1,12 @@
1
+ 4.0.2
2
+ ---
3
+ * Explicitly require forwardable (#204)
4
+
5
+ 4.0.1
6
+ ---
7
+ * Restore the old normalizing expected args behavior with symbols (#205)
8
+ * fixes an unintentional breaking change in 4.0.0
9
+
1
10
  4.0.0
2
11
  ---
3
12
  * [BREAKING] Dropped support for matching jobs on ActiveJob's private API args, (e.g. `_aj_globalid` and `_aj_ruby2_keywords`). `_aj_globalid` can be replaced with the object itself, e.g. `have_enqueued_sidekiq_job(user)`.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  **Welcome @wspurgin as new maintainer for `rspec-sidekiq`!**
2
2
 
3
- [![RubyGems][gem_version_badge]][ruby_gems]
3
+ [![Gem Version](https://badge.fury.io/rb/rspec-sidekiq.svg)](https://badge.fury.io/rb/rspec-sidekiq)
4
4
  [![Github Actions CI][github_actions_badge]][github_actions]
5
5
 
6
6
  Simple testing of Sidekiq jobs via a collection of matchers and helpers.
@@ -341,11 +341,7 @@ Please do! If there's a feature missing that you'd love to see then get in on th
341
341
 
342
342
  Issues/Pull Requests/Comments all welcome...
343
343
 
344
- [gem_version_badge]: https://badge.fury.io/rb/rspec-sidekiq.svg
345
344
  [github]: http://github.com/wspurgin/rspec-sidekiq
346
- [ruby_doc]: http://rubydoc.info/gems/rspec-sidekiq/frames
347
- [ruby_gems]: http://rubygems.org/gems/rspec-sidekiq
348
- [ruby_toolbox]: http://www.ruby-toolbox.com/projects/rspec-sidekiq
349
345
  [github_actions]: https://github.com/wspurgin/rspec-sidekiq/actions
350
346
  [github_actions_badge]: https://github.com/wspurgin/rspec-sidekiq/actions/workflows/main.yml/badge.svg
351
347
 
@@ -171,7 +171,7 @@ module RSpec
171
171
  end
172
172
 
173
173
  def with(*expected_arguments)
174
- @expected_arguments = expected_arguments
174
+ @expected_arguments = normalize_arguments(expected_arguments)
175
175
  self
176
176
  end
177
177
 
@@ -237,18 +237,17 @@ module RSpec
237
237
  RSpec::Support::ObjectFormatter.format(thing)
238
238
  end
239
239
 
240
- def jsonified_expected_arguments
241
- # We would just cast-to-parse-json, but we need to support
242
- # RSpec matcher args like #kind_of
243
- @jsonified_expected_arguments ||= begin
244
- expected_arguments.map do |arg|
245
- case arg.class
246
- when Symbol then arg.to_s
247
- when Hash then JSON.parse(arg.to_json)
248
- else
249
- arg
250
- end
240
+ def normalize_arguments(args)
241
+ if args.is_a?(Array)
242
+ args.map{ |x| normalize_arguments(x) }
243
+ elsif args.is_a?(Hash)
244
+ args.each_with_object({}) do |(key, value), hash|
245
+ hash[key.to_s] = normalize_arguments(value)
251
246
  end
247
+ elsif args.is_a?(Symbol)
248
+ args.to_s
249
+ else
250
+ args
252
251
  end
253
252
  end
254
253
  end
@@ -9,7 +9,7 @@ module RSpec
9
9
  class HaveEnqueuedSidekiqJob < Base
10
10
  def initialize(expected_arguments)
11
11
  super()
12
- @expected_arguments = expected_arguments
12
+ @expected_arguments = normalize_arguments(expected_arguments)
13
13
  end
14
14
 
15
15
  def matches?(job_class)
@@ -17,7 +17,7 @@ module RSpec
17
17
 
18
18
  @actual_jobs = EnqueuedJobs.new(klass)
19
19
 
20
- actual_jobs.includes?(jsonified_expected_arguments, expected_options)
20
+ actual_jobs.includes?(expected_arguments, expected_options)
21
21
  end
22
22
  end
23
23
  end
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module Sidekiq
3
- VERSION = "4.0.0"
3
+ VERSION = "4.0.2"
4
4
  end
5
5
  end
data/lib/rspec-sidekiq.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'forwardable'
2
+
1
3
  require 'sidekiq'
2
4
  require 'sidekiq/testing'
3
5
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aidan Coyle
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-08-15 00:00:00.000000000 Z
13
+ date: 2023-08-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec-core