You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
asciinema.org/spec/services/asciicast_frames_file_updat...

32 lines
737 B
Ruby

require 'rails_helper'
describe AsciicastFramesFileUpdater do
let(:updater) { described_class.new(file_writer) }
let(:file_writer) { double('file_writer') }
describe '#update' 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