asciinema.org/spec/serializers/asciicast_serializer_spec.rb

33 lines
756 B
Ruby
Raw Normal View History

2014-08-30 17:38:47 +00:00
require 'rails_helper'
describe AsciicastSerializer do
2013-10-20 15:03:20 +00:00
2015-12-22 17:40:20 +00:00
let(:serializer) { AsciicastSerializer.new(asciicast, playback_options: PlaybackOptions.new) }
let(:asciicast) { create(:asciicast) }
describe '#to_json' do
subject { JSON.parse(serializer.to_json) }
2013-10-20 15:03:20 +00:00
it 'includes id' do
expect(subject['id']).to eq(asciicast.to_param)
2013-10-20 15:03:20 +00:00
end
2015-12-22 17:40:20 +00:00
it 'includes url' do
expect(subject['url']).to eq(asciicast.file_url)
2013-10-20 15:03:20 +00:00
end
it 'includes snapshot' do
expect(subject['snapshot']).to eq(asciicast.snapshot)
end
it 'includes width' do
expect(subject['width']).to eq(asciicast.terminal_columns)
end
it 'includes height' do
expect(subject['height']).to eq(asciicast.terminal_lines)
end
end
end