eventsimple 1.4.2 → 1.4.3

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: c4e4684f9e4b569bd20e0b09e70a043d44d1f650530e192d8a4eb9e60fcc35c7
4
- data.tar.gz: 40ee62f907e02a421db4e83653c7c64953df65402c64613597fafa75ae2d8370
3
+ metadata.gz: 89459aafe1f0b6343f5893f9921d43e2b41a77bdd051160f8206837589941dc7
4
+ data.tar.gz: 9920a2bd4454bc8f97fbf9d9fc036ddc3801508321602a27cf1236de005a3633
5
5
  SHA512:
6
- metadata.gz: 4ba23518b78c46ca08a7b5669a2870a2e993054d95995c4bf7a564db63b0bcf5b8a141d380a3006fc2259f41689d6570a1ed9d39b8483badb84d1fb5f7d02105
7
- data.tar.gz: 9f27f387e7a7cff1631b6b4f427c167a692b1e2664783bd1a4ded614a3abb7266921c2f3195a521fe4e348064f3cce808e2eb9a481b58bdba4154f45af64179a
6
+ metadata.gz: fa543c41fa1318ab325ad2be11586ba642f07ba4210cb9163b309023da7c56cffb9220ffa92af85b57f43011e02a38a3f60e416fa5c96e6c6a3da8ef5f465541
7
+ data.tar.gz: c6a1e7bda23440825c00effa10ae939690f9b0963dd5269b048df08de4ea7de72785a6f26a168a0b2ddc7e1e3a038e8d20a35fccc55465130688058ee04b342c
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.2.2
1
+ 3.2.3
data/CHANGELOG.md CHANGED
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ## 1.4.3 - 2024-05-06
10
+ ### Changed
11
+ - The order of execution for synchronous reactors is now guaranteed to be the order in which they were registered.
12
+ - The shared examples for reactors `'an event which (a)synchronously dispatches'` now accept 1 or multiple arguments. The synchronous version checks that reactors are given in the order in which they are registered.
13
+
9
14
  ## 1.4.2 - 2024-04-30
10
15
  ### Changed
11
16
  - Raise error on missing consumer config
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eventsimple (1.4.2)
4
+ eventsimple (1.4.3)
5
5
  dry-struct (~> 1.6)
6
6
  dry-types (~> 1.7)
7
7
  pg (~> 1.4)
@@ -55,6 +55,7 @@ module Eventsimple
55
55
  end
56
56
 
57
57
  # Return a ReactorSet containing all Reactors matching an Event
58
+ # Reactors will be in the order in which they were registered
58
59
  def for(event)
59
60
  reactors = ReactorSet.new
60
61
 
@@ -77,16 +78,16 @@ module Eventsimple
77
78
  attr_reader :sync, :async
78
79
 
79
80
  def initialize
80
- @sync = Set.new
81
- @async = Set.new
81
+ @sync = []
82
+ @async = []
82
83
  end
83
84
 
84
85
  def add_sync(reactors)
85
- @sync += reactors
86
+ @sync |= reactors
86
87
  end
87
88
 
88
89
  def add_async(reactors)
89
- @async += reactors
90
+ @async |= reactors
90
91
  end
91
92
  end
92
93
  end
@@ -1,18 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- RSpec.shared_examples 'an event which synchronously dispatches' do |dispatcher_klass|
3
+ RSpec.shared_examples 'an event which synchronously dispatches' do |*dispatcher_klasses|
4
4
  specify do
5
5
  reactors = Eventsimple::EventDispatcher.rules.for(described_class.new)
6
6
 
7
- expect(reactors.sync).to include(dispatcher_klass)
7
+ # Order is important here since the synchronous reactors are executed sequentially
8
+ expect(reactors.sync & dispatcher_klasses).to eq(dispatcher_klasses)
8
9
  end
9
10
  end
10
11
 
11
- RSpec.shared_examples 'an event which asynchronously dispatches' do |dispatcher_klass|
12
+ RSpec.shared_examples 'an event which asynchronously dispatches' do |*dispatcher_klasses|
12
13
  specify do
13
14
  reactors = Eventsimple::EventDispatcher.rules.for(described_class.new)
14
15
 
15
- expect(reactors.async).to include(dispatcher_klass)
16
+ # Order is _not_ important here since async reactors have no order guarantee
17
+ expect(reactors.async).to include(*dispatcher_klasses)
16
18
  end
17
19
  end
18
20
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Eventsimple
4
- VERSION = '1.4.2'
4
+ VERSION = '1.4.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventsimple
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zulfiqar Ali
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-30 00:00:00.000000000 Z
11
+ date: 2024-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-struct
@@ -298,7 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
298
298
  - !ruby/object:Gem::Version
299
299
  version: '0'
300
300
  requirements: []
301
- rubygems_version: 3.4.10
301
+ rubygems_version: 3.4.19
302
302
  signing_key:
303
303
  specification_version: 4
304
304
  summary: Event sourcing toolkit using Rails and ActiveJob