mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 01:01:39 -05:00
Update json_stream_handler_spec.rb path and remove tmp.json
This commit is contained in:
parent
6591a629ad
commit
fa995a7f84
2 changed files with 10 additions and 9 deletions
|
|
@ -7,14 +7,8 @@ RSpec.describe JsonStreamHandler do
|
||||||
let(:processor) { double('StreamProcessor') }
|
let(:processor) { double('StreamProcessor') }
|
||||||
let(:handler) { described_class.new(processor) }
|
let(:handler) { described_class.new(processor) }
|
||||||
|
|
||||||
before do
|
let(:payload) 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 = {
|
|
||||||
'counts' => { 'places' => 2, 'visits' => 1, 'points' => 1 },
|
'counts' => { 'places' => 2, 'visits' => 1, 'points' => 1 },
|
||||||
'settings' => { 'theme' => 'dark' },
|
'settings' => { 'theme' => 'dark' },
|
||||||
'areas' => [{ 'name' => 'Home' }],
|
'areas' => [{ 'name' => 'Home' }],
|
||||||
|
|
@ -33,7 +27,15 @@ RSpec.describe JsonStreamHandler do
|
||||||
{ 'timestamp' => 1, 'lonlat' => 'POINT(2 1)' }
|
{ '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))
|
Oj.saj_parse(handler, Oj.dump(payload, mode: :compat))
|
||||||
|
|
||||||
expect(processor).to have_received(:handle_section).with('counts', hash_including('places' => 2))
|
expect(processor).to have_received(:handle_section).with('counts', hash_including('places' => 2))
|
||||||
1
tmp.json
1
tmp.json
|
|
@ -1 +0,0 @@
|
||||||
{"a":1}
|
|
||||||
Loading…
Reference in a new issue