Skip to content

Commit

Permalink
Add test for logging SP without request
Browse files Browse the repository at this point in the history
  • Loading branch information
matthinz committed Oct 23, 2024
1 parent 82097d8 commit 330161e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion spec/services/analytics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
browser_bot: false,
hostname: FakeRequest.new.host,
pid: Process.pid,
service_provider: 'http://localhost:3000',
trace_id: nil,
}
end
Expand Down Expand Up @@ -194,6 +193,19 @@
end
end
end

context 'when no request specified' do
let(:request) { nil }
context 'but an SP was specified via initializer' do
it 'logs the SP' do
expect(ahoy).to receive(:track).with(
'Trackable Event',
hash_including(service_provider: 'http://localhost:3000'),
)
analytics.track_event('Trackable Event')
end
end
end
end

it 'tracks session duration' do
Expand Down

0 comments on commit 330161e

Please sign in to comment.