2013-08-04 20:43:36 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Stdout do
|
2013-08-13 17:27:02 +00:00
|
|
|
let(:stdout) { Stdout.new(data_file, timing_file) }
|
|
|
|
let(:data_file) { double('data_file', :decompressed_path => 'spec/fixtures/stdout.decompressed') }
|
|
|
|
let(:timing_file) { double('timing_file', :decompressed_path => 'spec/fixtures/stdout.time.decompressed') }
|
2013-08-04 20:43:36 +00:00
|
|
|
|
|
|
|
describe '#each' do
|
2013-08-13 17:27:02 +00:00
|
|
|
it 'yields for each frame with delay and data' do
|
|
|
|
expect { |b| stdout.each(&b) }.
|
|
|
|
to yield_successive_args([0.5, 'foobar'],
|
|
|
|
[1.0, "bazqux\xC5"],
|
|
|
|
[2.0, "\xBCółć"])
|
|
|
|
end
|
|
|
|
end
|
2013-08-04 20:43:36 +00:00
|
|
|
|
2013-08-13 17:27:02 +00:00
|
|
|
describe '#each_until' do
|
|
|
|
it 'yields for each frame with delay and data until given time (in seconds)' do
|
|
|
|
expect { |b| stdout.each_until(1.7, &b) }.
|
|
|
|
to yield_successive_args([0.5, 'foobar'], [1.0, "bazqux\xC5"])
|
2013-08-04 20:43:36 +00:00
|
|
|
end
|
|
|
|
end
|
2013-08-13 17:27:02 +00:00
|
|
|
|
2013-08-04 20:43:36 +00:00
|
|
|
end
|