asciinema.org/spec/services/asciicast_frames_file_updater_spec.rb

32 lines
763 B
Ruby
Raw Normal View History

2014-08-30 17:38:47 +00:00
require 'rails_helper'
describe AsciicastFramesFileUpdater do
let(:updater) { described_class.new(file_writer) }
let(:file_writer) { double('file_writer') }
describe '#update', needs_terminal_bin: true do
let(:asciicast) { create(:asciicast) }
let(:film) { double('film', :frames => frames) }
let(:frames) { [1, 2] }
subject { updater.update(asciicast) }
before do
allow(Film).to receive(:new).with(asciicast.stdout, kind_of(Terminal)) {
film
}
allow(file_writer).to receive(:write_enumerable) do |file, frames|
file << frames.to_json
end
end
it 'updates stdout_frames file on asciicast' do
subject
expect(asciicast.stdout_frames.read).to eq('[1,2]')
end
end
end