Skip to content

Commit

Permalink
Rename to match instrumented methods and their arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
mostlyobvious committed Jan 30, 2023
1 parent 0611e35 commit 56f4bb3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion rails_event_store/spec/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module RailsEventStore
specify "wraps mapper into instrumentation" do
client = Client.new(repository: RubyEventStore::InMemoryRepository.new, mapper: RubyEventStore::Mappers::Default.new)
received_notifications = 0
ActiveSupport::Notifications.subscribe("serialize.mapper.ruby_event_store") { received_notifications += 1 }
ActiveSupport::Notifications.subscribe("event_to_record.mapper.ruby_event_store") { received_notifications += 1 }

client.publish(TestEvent.new)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ def initialize(mapper, instrumentation)
end

def event_to_record(event)
instrumentation.instrument("serialize.mapper.ruby_event_store", domain_event: event) do
instrumentation.instrument("event_to_record.mapper.ruby_event_store", event: event) do
mapper.event_to_record(event)
end
end

def record_to_event(record)
instrumentation.instrument("deserialize.mapper.ruby_event_store", record: record) do
instrumentation.instrument("record_to_event.mapper.ruby_event_store", record: record) do
mapper.record_to_event(record)
end
end
Expand Down
6 changes: 3 additions & 3 deletions ruby_event_store/spec/mappers/instrumented_mapper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ module Mappers

specify "instruments" do
instrumented_mapper = InstrumentedMapper.new(spy, ActiveSupport::Notifications)
subscribe_to("serialize.mapper.ruby_event_store") do |notification_calls|
subscribe_to("event_to_record.mapper.ruby_event_store") do |notification_calls|
instrumented_mapper.event_to_record(event)
expect(notification_calls).to eq([{ domain_event: event }])
expect(notification_calls).to eq([{ event: event }])
end
end
end
Expand All @@ -38,7 +38,7 @@ module Mappers

specify "instruments" do
instrumented_mapper = InstrumentedMapper.new(spy, ActiveSupport::Notifications)
subscribe_to("deserialize.mapper.ruby_event_store") do |notification_calls|
subscribe_to("record_to_event.mapper.ruby_event_store") do |notification_calls|
instrumented_mapper.record_to_event(record)
expect(notification_calls).to eq([{ record: record }])
end
Expand Down

0 comments on commit 56f4bb3

Please sign in to comment.