journaled 4.0.0 → 4.1.0

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: 4cefb08a9d7ab294f9084f150f89cda921982fffdb0ec7b0a5bc702ede1d23b8
4
- data.tar.gz: 21a484a10c58a3f551e95af064b5f718b9496ba7840ac6c1ac84142b859942db
3
+ metadata.gz: 88602263644ea51719a18c5ee3e719d2c13a9e69049e1f20a52a44edc38a0835
4
+ data.tar.gz: c7cafdb9f305e51c3590d09815d5d6f909db496866c774ab442ffaa334be927c
5
5
  SHA512:
6
- metadata.gz: 59d07f836a83dde4e4a24a8a5f326ff5cbc7a751d92fb6df66ee22b5b31ac1aa63326675167d45bcd8c572a0e4afeb831774a468eb45097a71c6940a79ce2681
7
- data.tar.gz: 807c603b1085819ed003ed8053f81b6fec59ba895c920bc24ac178b0d3188fac554a2ed9b2dcb80ceceb2a26fc5effe6af5d52819f66d041ad7959cfc30957da
6
+ metadata.gz: 6bf229efd53882ed50931c964c1564b01603fa22ea2083b8a6039d0a0ed972d2cdc7bfc5913a9e9539d7dd023294c2a226963e2e2a526bf857926afe3e0c76c0
7
+ data.tar.gz: cf7b28c58c40c9ee8348df60095a7b544c0a8b0ea448ffa20021aceda61ae2feda61110ef9685756d4bac7d3d887e12a181f1840d435b2d2f85aeba5d8a52e45
data/README.md CHANGED
@@ -18,6 +18,8 @@ add scoped ordering capability at a future date (and would gladly
18
18
  entertain pull requests), but it is presently only designed to provide a
19
19
  durable, eventually consistent record that discrete events happened.
20
20
 
21
+ **See [upgrades](#upgrades) below if you're upgrading from an older `journaled` version!**
22
+
21
23
  ## Installation
22
24
 
23
25
  1. If you haven't already,
@@ -83,52 +85,15 @@ app's Gemfile.
83
85
 
84
86
  The AWS principal whose credentials are in the environment will need to be allowed to assume this role.
85
87
 
86
- ### Upgrading from 3.1.0
87
-
88
- Versions of Journaled prior to 4.0 relied directly on environment variables for stream names, but now stream names are configured directly.
89
- When upgrading, you can use the following configuration to maintain the previous behavior:
90
-
91
- ```ruby
92
- Journaled.default_stream_name = ENV['JOURNALED_STREAM_NAME']
93
- ```
94
-
95
- If you previously specified a `Journaled.default_app_name`, you would have required a more precise environment variable name (substitute `{{upcase_app_name}}`):
96
-
97
- ```ruby
98
- Journaled.default_stream_name = ENV["{{upcase_app_name}}_JOURNALED_STREAM_NAME"]
99
- ```
100
-
101
- And if you had defined any `journaled_app_name` methods on `Journaled::Event` instances, you can replace them with the following:
102
-
103
- ```ruby
104
- def journaled_stream_name
105
- ENV['{{upcase_app_name}}_JOURNALED_STREAM_NAME']
106
- end
107
- ```
108
-
109
- When upgrading from 3.1 or below, `Journaled::DeliveryJob` will handle any jobs that remain in the queue by accepting an `app_name` argument. **This behavior will be removed in version 5.0**, so it is recommended to upgrade one major version at a time.
110
-
111
- ### Upgrading from 2.5.0
112
-
113
- Versions of Journaled prior to 3.0 relied direclty on `delayed_job` and a "performable" class called `Journaled::Delivery`.
114
- In 3.0, this was superceded by an ActiveJob class called `Journaled::DeliveryJob`, but the `Journaled::Delivery` class was not removed until 4.0.
115
-
116
- Therefore, when upgrading from 2.5.0 or below, it is recommended to first upgrade to 3.1.0 (to allow any `Journaled::Delivery` jobs to finish working off) before upgrading to 4.0+.
117
-
118
- The upgrade to 3.1.0 will require a working ActiveJob config. ActiveJob can be configured globally by setting `ActiveJob::Base.queue_adapter`, or just for Journaled jobs by setting `Journaled::DeliveryJob.queue_adapter`.
119
- The `:delayed_job` queue adapter will allow you to continue relying on `delayed_job`. You may also consider switching your app(s) to [`delayed`](https://github.com/Betterment/delayed) and using the `:delayed` queue adapter.
120
-
121
88
  ## Usage
122
89
 
123
90
  ### Configuration
124
91
 
125
92
  Journaling provides a number of different configuation options that can be set in Ruby using an initializer. Those values are:
126
93
 
127
- #### `Journaled.default_app_name`
94
+ #### `Journaled.default_stream_name `
128
95
 
129
- This is described in the proceeding paragraph and is used to specify which app name to use, which corresponds to which Journaled Stream to send events too.
130
- This is the default value for events that do NOT specify their own `#journaled_app_name`. For events that define their own `#journaled_app_name` method, that will take precedence over this default.
131
- Ex: `Journaled.default_app_name = 'my_app'`
96
+ This is described in the "Installation" section above, and is used to specify which stream name to use.
132
97
 
133
98
  #### `Journaled.job_priority` (default: 20)
134
99
 
@@ -185,8 +150,8 @@ class ApplicationController < ActionController::Base
185
150
  end
186
151
  ```
187
152
 
188
- Your authenticated entity must respond to `#to_global_id`, which
189
- ActiveRecords do by default.
153
+ Your authenticated entity must respond to `#to_global_id`, which ActiveRecords do by default.
154
+ This feature relies on `ActiveSupport::CurrentAttributes` under the hood.
190
155
 
191
156
  Every time any of the specified attributes is modified, or a `User`
192
157
  record is created or destroyed, an event will be sent to Kinesis with the following attributes:
@@ -214,6 +179,40 @@ journaling. Note that the less-frequently-used methods `toggle`,
214
179
  `increment*`, `decrement*`, and `update_counters` are not intercepted at
215
180
  this time.
216
181
 
182
+ ### Tagged Events
183
+
184
+ Events may be optionally marked as "tagged." This will add a `tags` field, intended for tracing and
185
+ auditing purposes.
186
+
187
+ ```ruby
188
+ class MyEvent
189
+ include Journaled::Event
190
+
191
+ journal_attributes :attr_1, :attr_2, tagged: true
192
+ end
193
+ ```
194
+
195
+ You may then use `Journaled.tag!` and `Journaled.tagged` inside of your
196
+ `ApplicationController` and `ApplicationJob` classes (or anywhere else!) to tag
197
+ all events with request and job metadata:
198
+
199
+ ```ruby
200
+ class ApplicationController < ActionController::Base
201
+ before_action do
202
+ Journaled.tag!(request_id: request.request_id, current_user_id: current_user&.id)
203
+ end
204
+ end
205
+
206
+ class ApplicationJob < ActiveJob::Base
207
+ around_perform do |job, perform|
208
+ Journaled.tagged(job_id: job.id) { perform.call }
209
+ end
210
+ end
211
+ ```
212
+
213
+ This feature relies on `ActiveSupport::CurrentAttributes` under the hood, so these tags are local to
214
+ the current thread, and will be cleared at the end of each request request/job.
215
+
217
216
  #### Testing
218
217
 
219
218
  If you use RSpec (and have required `journaled/rspec` in your
@@ -353,6 +352,49 @@ Returns one of the following in order of preference:
353
352
  In order for this to be most useful, you must configure your controller
354
353
  as described in [Change Journaling](#change-journaling) above.
355
354
 
355
+ ## Upgrades
356
+
357
+ Since this gem relies on background jobs (which can remain in the queue across
358
+ code releases), this gem generally aims to support jobs enqueued by the prior
359
+ gem version.
360
+
361
+ As such, **we always recommend upgrading only one major version at a time.**
362
+
363
+ ### Upgrading from 3.1.0
364
+
365
+ Versions of Journaled prior to 4.0 relied directly on environment variables for stream names, but now stream names are configured directly.
366
+ When upgrading, you can use the following configuration to maintain the previous behavior:
367
+
368
+ ```ruby
369
+ Journaled.default_stream_name = ENV['JOURNALED_STREAM_NAME']
370
+ ```
371
+
372
+ If you previously specified a `Journaled.default_app_name`, you would have required a more precise environment variable name (substitute `{{upcase_app_name}}`):
373
+
374
+ ```ruby
375
+ Journaled.default_stream_name = ENV["{{upcase_app_name}}_JOURNALED_STREAM_NAME"]
376
+ ```
377
+
378
+ And if you had defined any `journaled_app_name` methods on `Journaled::Event` instances, you can replace them with the following:
379
+
380
+ ```ruby
381
+ def journaled_stream_name
382
+ ENV['{{upcase_app_name}}_JOURNALED_STREAM_NAME']
383
+ end
384
+ ```
385
+
386
+ When upgrading from 3.1 or below, `Journaled::DeliveryJob` will handle any jobs that remain in the queue by accepting an `app_name` argument. **This behavior will be removed in version 5.0**, so it is recommended to upgrade one major version at a time.
387
+
388
+ ### Upgrading from 2.5.0
389
+
390
+ Versions of Journaled prior to 3.0 relied direclty on `delayed_job` and a "performable" class called `Journaled::Delivery`.
391
+ In 3.0, this was superceded by an ActiveJob class called `Journaled::DeliveryJob`, but the `Journaled::Delivery` class was not removed until 4.0.
392
+
393
+ Therefore, when upgrading from 2.5.0 or below, it is recommended to first upgrade to 3.1.0 (to allow any `Journaled::Delivery` jobs to finish working off) before upgrading to 4.0+.
394
+
395
+ The upgrade to 3.1.0 will require a working ActiveJob config. ActiveJob can be configured globally by setting `ActiveJob::Base.queue_adapter`, or just for Journaled jobs by setting `Journaled::DeliveryJob.queue_adapter`.
396
+ The `:delayed_job` queue adapter will allow you to continue relying on `delayed_job`. You may also consider switching your app(s) to [`delayed`](https://github.com/Betterment/delayed) and using the `:delayed` queue adapter.
397
+
356
398
  ## Future improvements & issue tracking
357
399
  Suggestions for enhancements to this engine are currently being tracked via Github Issues. Please feel free to open an
358
400
  issue for a desired feature, as well as for any observed bugs.
@@ -2,11 +2,14 @@ module Journaled::Actor
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  included do
5
- class_attribute :_journaled_actor_method_name, instance_accessor: false, instance_predicate: false
6
- before_action do
7
- RequestStore.store[:journaled_actor_proc] = self.class._journaled_actor_method_name &&
8
- -> { send(self.class._journaled_actor_method_name) }
9
- end
5
+ class_attribute :_journaled_actor_method_name, instance_writer: false
6
+ before_action :_set_journaled_actor_proc, if: :_journaled_actor_method_name?
7
+ end
8
+
9
+ private
10
+
11
+ def _set_journaled_actor_proc
12
+ Journaled::Current.journaled_actor_proc = -> { send(self.class._journaled_actor_method_name) }
10
13
  end
11
14
 
12
15
  class_methods do
@@ -8,8 +8,7 @@ class Journaled::ActorUriProvider
8
8
  private
9
9
 
10
10
  def actor_global_id_uri
11
- actor = RequestStore.store[:journaled_actor_proc]&.call
12
- actor.to_global_id.to_s if actor
11
+ Journaled::Current.actor&.to_global_id&.to_s
13
12
  end
14
13
 
15
14
  def fallback_global_id_uri
@@ -39,12 +39,18 @@ module Journaled::Event
39
39
  Journaled.default_stream_name
40
40
  end
41
41
 
42
+ def tagged?
43
+ false
44
+ end
45
+
42
46
  private
43
47
 
44
48
  class_methods do
45
- def journal_attributes(*args, enqueue_with: {})
49
+ def journal_attributes(*args, enqueue_with: {}, tagged: false)
46
50
  journaled_attributes.concat(args)
47
51
  journaled_enqueue_opts.merge!(enqueue_with)
52
+
53
+ include Tagged if tagged
48
54
  end
49
55
 
50
56
  def journaled_attributes
@@ -61,4 +67,20 @@ module Journaled::Event
61
67
 
62
68
  journal_attributes :id, :event_type, :created_at
63
69
  end
70
+
71
+ module Tagged
72
+ extend ActiveSupport::Concern
73
+
74
+ included do
75
+ journaled_attributes << :tags
76
+ end
77
+
78
+ def tags
79
+ Journaled::Current.tags
80
+ end
81
+
82
+ def tagged?
83
+ true
84
+ end
85
+ end
64
86
  end
@@ -25,8 +25,7 @@ class Journaled::Writer
25
25
  end
26
26
 
27
27
  def journal!
28
- base_event_json_schema_validator.validate! serialized_event
29
- json_schema_validator.validate! serialized_event
28
+ validate!
30
29
  Journaled::DeliveryJob
31
30
  .set(journaled_enqueue_opts.reverse_merge(priority: Journaled.job_priority))
32
31
  .perform_later(delivery_perform_args)
@@ -37,6 +36,12 @@ class Journaled::Writer
37
36
  attr_reader :journaled_event
38
37
  delegate(*EVENT_METHOD_NAMES, to: :journaled_event)
39
38
 
39
+ def validate!
40
+ schema_validator('base_event').validate! serialized_event
41
+ schema_validator('tagged_event').validate! serialized_event if journaled_event.tagged?
42
+ schema_validator(journaled_schema_name).validate! serialized_event
43
+ end
44
+
40
45
  def delivery_perform_args
41
46
  {
42
47
  serialized_event: serialized_event,
@@ -49,12 +54,8 @@ class Journaled::Writer
49
54
  @serialized_event ||= journaled_attributes.to_json
50
55
  end
51
56
 
52
- def json_schema_validator
53
- @json_schema_validator ||= Journaled::JsonSchemaModel::Validator.new(journaled_schema_name)
54
- end
55
-
56
- def base_event_json_schema_validator
57
- @base_event_json_schema_validator ||= Journaled::JsonSchemaModel::Validator.new('base_event')
57
+ def schema_validator(schema_name)
58
+ Journaled::JsonSchemaModel::Validator.new(schema_name)
58
59
  end
59
60
 
60
61
  def respond_to_all?(object, method_names)
@@ -0,0 +1,14 @@
1
+ {
2
+ "type": "object",
3
+ "title": "tagged_event",
4
+ "additionalProperties": true,
5
+ "required": [
6
+ "tags"
7
+ ],
8
+ "properties": {
9
+ "tags": {
10
+ "type": "object",
11
+ "additionalProperties": true
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,18 @@
1
+ module Journaled
2
+ class Current < ActiveSupport::CurrentAttributes
3
+ attribute :tags
4
+ attribute :journaled_actor_proc
5
+
6
+ def tags=(value)
7
+ super(value.freeze)
8
+ end
9
+
10
+ def tags
11
+ attributes[:tags] ||= {}.freeze
12
+ end
13
+
14
+ def actor
15
+ journaled_actor_proc&.call
16
+ end
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module Journaled
2
- VERSION = "4.0.0".freeze
2
+ VERSION = "4.1.0".freeze
3
3
  end
data/lib/journaled.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  require "aws-sdk-kinesis"
2
2
  require "active_job"
3
3
  require "json-schema"
4
- require "request_store"
5
4
 
6
5
  require "journaled/engine"
6
+ require "journaled/current"
7
7
 
8
8
  module Journaled
9
9
  SUPPORTED_QUEUE_ADAPTERS = %w(delayed delayed_job good_job que).freeze
@@ -51,5 +51,17 @@ module Journaled
51
51
  end
52
52
  end
53
53
 
54
+ def self.tagged(**tags)
55
+ existing_tags = Current.tags
56
+ tag!(tags)
57
+ yield
58
+ ensure
59
+ Current.tags = existing_tags
60
+ end
61
+
62
+ def self.tag!(**tags)
63
+ Current.tags = Current.tags.merge(tags)
64
+ end
65
+
54
66
  module_function :development_or_test?, :enabled?, :schema_providers, :commit_hash, :actor_uri, :detect_queue_adapter!
55
67
  end
@@ -5,11 +5,10 @@ RSpec.describe Journaled::Actor do
5
5
  let(:user) { double("User") }
6
6
  let(:klass) do
7
7
  Class.new do
8
- cattr_accessor :before_actions
9
- self.before_actions = []
8
+ cattr_accessor(:before_actions) { [] }
10
9
 
11
- def self.before_action(&hook)
12
- before_actions << hook
10
+ def self.before_action(method_name, _opts)
11
+ before_actions << method_name
13
12
  end
14
13
 
15
14
  include Journaled::Actor
@@ -21,7 +20,7 @@ RSpec.describe Journaled::Actor do
21
20
  end
22
21
 
23
22
  def trigger_before_actions
24
- before_actions.each { |proc| instance_eval(&proc) }
23
+ before_actions.each { |method_name| send(method_name) }
25
24
  end
26
25
  end
27
26
  end
@@ -33,7 +32,8 @@ RSpec.describe Journaled::Actor do
33
32
 
34
33
  allow(subject).to receive(:current_user).and_return(nil)
35
34
 
36
- expect(RequestStore.store[:journaled_actor_proc].call).to eq nil
35
+ expect(Journaled::Current.journaled_actor_proc.call).to eq nil
36
+ expect(Journaled::Current.actor).to eq nil
37
37
  end
38
38
 
39
39
  it "Stores a thunk returning current_user if it is set when called" do
@@ -41,6 +41,7 @@ RSpec.describe Journaled::Actor do
41
41
 
42
42
  allow(subject).to receive(:current_user).and_return(user)
43
43
 
44
- expect(RequestStore.store[:journaled_actor_proc].call).to eq user
44
+ expect(Journaled::Current.journaled_actor_proc.call).to eq user
45
+ expect(Journaled::Current.actor).to eq user
45
46
  end
46
47
  end
@@ -2,7 +2,7 @@ require 'rails_helper'
2
2
 
3
3
  RSpec.describe Journaled::ActorUriProvider do
4
4
  describe "#actor_uri" do
5
- let(:request_store) { double(:[] => nil) }
5
+ let(:current_attributes) { double(:[] => nil) }
6
6
  let(:actor) { double(to_global_id: actor_gid) }
7
7
  let(:actor_gid) { double(to_s: "my_fancy_gid") }
8
8
  let(:program_name) { "/usr/local/bin/puma_or_something" }
@@ -17,13 +17,14 @@ RSpec.describe Journaled::ActorUriProvider do
17
17
  end
18
18
 
19
19
  before do
20
- allow(RequestStore).to receive(:store).and_return(request_store)
20
+ allow(Journaled::Current.instance)
21
+ .to receive(:attributes).and_return(current_attributes)
21
22
  end
22
23
 
23
- it "returns the global ID of the entity returned by RequestStore.store[:journaled_actor_proc].call if set" do
24
- allow(request_store).to receive(:[]).and_return(-> { actor })
24
+ it "returns the global ID of the entity returned by Current.journaled_actor_proc.call if set" do
25
+ allow(current_attributes).to receive(:[]).and_return(-> { actor })
25
26
  expect(subject.actor_uri).to eq("my_fancy_gid")
26
- expect(request_store).to have_received(:[]).with(:journaled_actor_proc)
27
+ expect(current_attributes).to have_received(:[]).with(:journaled_actor_proc)
27
28
  end
28
29
 
29
30
  context "when running in rake" do
@@ -88,8 +88,10 @@ RSpec.describe Journaled::Event do
88
88
 
89
89
  context 'when no additional attributes have been defined' do
90
90
  it 'returns the base attributes, and memoizes them after the first call' do
91
- expect(sample_journaled_event.journaled_attributes).to eq id: fake_uuid, created_at: frozen_time, event_type: 'some_class_name'
92
- expect(sample_journaled_event.journaled_attributes).to eq id: fake_uuid, created_at: frozen_time, event_type: 'some_class_name'
91
+ expect(sample_journaled_event.journaled_attributes)
92
+ .to eq id: fake_uuid, created_at: frozen_time, event_type: 'some_class_name'
93
+ expect(sample_journaled_event.journaled_attributes)
94
+ .to eq id: fake_uuid, created_at: frozen_time, event_type: 'some_class_name'
93
95
  end
94
96
  end
95
97
 
@@ -134,6 +136,80 @@ RSpec.describe Journaled::Event do
134
136
  )
135
137
  end
136
138
  end
139
+
140
+ context 'tagged: true' do
141
+ before do
142
+ sample_journaled_event_class.journal_attributes tagged: true
143
+ end
144
+
145
+ it 'adds a "tags" attribute' do
146
+ expect(sample_journaled_event.journaled_attributes).to include(tags: {})
147
+ end
148
+
149
+ context 'when tags are specified' do
150
+ around do |example|
151
+ Journaled.tag!(foo: 'bar')
152
+ Journaled.tagged(baz: 'bat') { example.run }
153
+ end
154
+
155
+ it 'adds them to the journaled attributes' do
156
+ expect(sample_journaled_event.journaled_attributes).to include(
157
+ tags: { foo: 'bar', baz: 'bat' },
158
+ )
159
+ end
160
+
161
+ context 'when even more tags are nested' do
162
+ it 'merges them in and then resets them' do
163
+ Journaled.tagged(oh_no: 'even more tags') do
164
+ expect(sample_journaled_event.journaled_attributes).to include(
165
+ tags: { foo: 'bar', baz: 'bat', oh_no: 'even more tags' },
166
+ )
167
+ end
168
+
169
+ allow(SecureRandom).to receive(:uuid).and_return(fake_uuid).once
170
+ expect(sample_journaled_event_class.new.journaled_attributes).to include(
171
+ tags: { foo: 'bar', baz: 'bat' },
172
+ )
173
+ end
174
+ end
175
+
176
+ context 'when custom event tags are also specified and merged' do
177
+ let(:sample_journaled_event_class) do
178
+ Class.new do
179
+ include Journaled::Event
180
+
181
+ def tags
182
+ super.merge(abc: '123')
183
+ end
184
+ end
185
+ end
186
+
187
+ it 'combines all tags' do
188
+ expect(sample_journaled_event.journaled_attributes).to include(
189
+ tags: { foo: 'bar', baz: 'bat', abc: '123' },
190
+ )
191
+ end
192
+ end
193
+
194
+ context 'when custom event tags are also specified but not merged' do
195
+ let(:sample_journaled_event_class) do
196
+ Class.new do
197
+ include Journaled::Event
198
+
199
+ def tags
200
+ { bananas: 'are great', but_not_actually: 'the best source of potassium' } # it's true
201
+ end
202
+ end
203
+ end
204
+
205
+ it 'adds them to the journaled attributes' do
206
+ expect(sample_journaled_event.journaled_attributes).to include(
207
+ tags: { bananas: 'are great', but_not_actually: 'the best source of potassium' },
208
+ )
209
+ end
210
+ end
211
+ end
212
+ end
137
213
  end
138
214
 
139
215
  describe '#journaled_enqueue_opts, .journaled_enqueue_opts' do
@@ -77,6 +77,7 @@ RSpec.describe Journaled::Writer do
77
77
  journaled_partition_key: 'fake_partition_key',
78
78
  journaled_stream_name: 'my_app_events',
79
79
  journaled_enqueue_opts: journaled_enqueue_opts,
80
+ tagged?: false,
80
81
  )
81
82
  end
82
83
 
@@ -141,5 +142,33 @@ RSpec.describe Journaled::Writer do
141
142
  end
142
143
  end
143
144
  end
145
+
146
+ context 'when the event is tagged' do
147
+ before do
148
+ allow(journaled_event).to receive(:tagged?).and_return(true)
149
+ end
150
+
151
+ context 'and the "tags" attribute is not present' do
152
+ let(:journaled_event_attributes) do
153
+ { id: 'FAKE_UUID', event_type: 'fake_event', created_at: Time.zone.now, foo: 'bar' }
154
+ end
155
+
156
+ it 'raises an error and does not enqueue anything' do
157
+ expect { subject.journal! }.to raise_error JSON::Schema::ValidationError
158
+ expect(enqueued_jobs.count).to eq 0
159
+ end
160
+ end
161
+
162
+ context 'and the "tags" attribute is present' do
163
+ let(:journaled_event_attributes) do
164
+ { id: 'FAKE_UUID', event_type: 'fake_event', created_at: Time.zone.now, foo: 'bar', tags: { baz: 'bat' } }
165
+ end
166
+
167
+ it 'creates a delivery with the app name passed through' do
168
+ expect { subject.journal! }.to change { enqueued_jobs.count }.from(0).to(1)
169
+ expect(enqueued_jobs.first[:args].first).to include('stream_name' => 'my_app_events')
170
+ end
171
+ end
172
+ end
144
173
  end
145
174
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: journaled
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Lipson
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2021-10-27 00:00:00.000000000 Z
14
+ date: 2021-11-04 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activejob
@@ -83,20 +83,6 @@ dependencies:
83
83
  - - ">="
84
84
  - !ruby/object:Gem::Version
85
85
  version: '5.2'
86
- - !ruby/object:Gem::Dependency
87
- name: request_store
88
- requirement: !ruby/object:Gem::Requirement
89
- requirements:
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- version: '0'
93
- type: :runtime
94
- prerelease: false
95
- version_requirements: !ruby/object:Gem::Requirement
96
- requirements:
97
- - - ">="
98
- - !ruby/object:Gem::Version
99
- version: '0'
100
86
  - !ruby/object:Gem::Dependency
101
87
  name: appraisal
102
88
  requirement: !ruby/object:Gem::Requirement
@@ -253,7 +239,9 @@ files:
253
239
  - config/spring.rb
254
240
  - journaled_schemas/base_event.json
255
241
  - journaled_schemas/journaled/change.json
242
+ - journaled_schemas/tagged_event.json
256
243
  - lib/journaled.rb
244
+ - lib/journaled/current.rb
257
245
  - lib/journaled/engine.rb
258
246
  - lib/journaled/relation_change_protection.rb
259
247
  - lib/journaled/rspec.rb