2014-08-30 17:38:47 +00:00
|
|
|
require 'rails_helper'
|
2013-09-20 21:21:25 +00:00
|
|
|
|
|
|
|
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) }
|
2013-09-20 21:21:25 +00:00
|
|
|
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
|
2015-05-13 10:43:49 +00:00
|
|
|
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
|
2013-09-20 21:21:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|