mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-06 05:09:40 -06:00
Update json_stream_handler_spec.rb path and remove tmp.json
This commit is contained in:
@@ -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))
|
||||
Reference in New Issue
Block a user