diff --git a/app/services/frontend_logger.rb b/app/services/frontend_logger.rb index 316dfe549f6..8c41a9f21d8 100644 --- a/app/services/frontend_logger.rb +++ b/app/services/frontend_logger.rb @@ -8,14 +8,7 @@ def initialize(analytics:, event_map:) def track_event(name, attributes) if (analytics_method = event_map[name]) - if analytics_method.is_a?(Proc) - analytics_method.call(analytics, **attributes) - else - analytics_method.bind_call( - analytics, - **hash_from_method_kwargs(attributes, analytics_method), - ) - end + analytics_method.bind_call(analytics, **hash_from_method_kwargs(attributes, analytics_method)) else analytics.track_event("Frontend: #{name}", attributes) end diff --git a/spec/services/frontend_logger_spec.rb b/spec/services/frontend_logger_spec.rb index fa4f34a799a..0ee377968a6 100644 --- a/spec/services/frontend_logger_spec.rb +++ b/spec/services/frontend_logger_spec.rb @@ -12,10 +12,8 @@ class ExampleAnalytics < FakeAnalytics end let(:analytics) { ExampleAnalytics.new } - let(:proc_handler) { proc {} } let(:event_map) do { - 'proc' => proc_handler, 'method' => ExampleAnalyticsEvents.instance_method(:example_method_handler), } end @@ -37,16 +35,6 @@ class ExampleAnalytics < FakeAnalytics end end - context 'with proc event handler' do - let(:name) { 'proc' } - - it 'calls proc with analytics instance' do - expect(proc_handler).to receive(:call).with(analytics, attributes) - - call - end - end - context 'with method handler' do let(:name) { 'method' }