Update json_stream_handler_spec.rb path and remove tmp.json

This commit is contained in:
Eugene Burmakin
2025-10-05 21:01:34 +02:00
parent 6591a629ad
commit fa995a7f84
2 changed files with 10 additions and 9 deletions

View File

@@ -7,14 +7,8 @@ RSpec.describe JsonStreamHandler do
let(:processor) { double('StreamProcessor') }
let(:handler) { described_class.new(processor) }
before do
allow(processor).to receive(:handle_section)
allow(processor).to receive(:handle_stream_value)
allow(processor).to receive(:finish_stream)
end
it 'streams configured sections and delegates other values immediately' do
payload = {
let(:payload) do
{
'counts' => { 'places' => 2, 'visits' => 1, 'points' => 1 },
'settings' => { 'theme' => 'dark' },
'areas' => [{ 'name' => 'Home' }],
@@ -33,7 +27,15 @@ RSpec.describe JsonStreamHandler do
{ 'timestamp' => 1, 'lonlat' => 'POINT(2 1)' }
]
}
end
before do
allow(processor).to receive(:handle_section)
allow(processor).to receive(:handle_stream_value)
allow(processor).to receive(:finish_stream)
end
it 'streams configured sections and delegates other values immediately' do
Oj.saj_parse(handler, Oj.dump(payload, mode: :compat))
expect(processor).to have_received(:handle_section).with('counts', hash_including('places' => 2))

View File

@@ -1 +0,0 @@
{"a":1}