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
|
|
|
|
2013-09-20 21:21:25 +00:00
|
|
|
let(:serializer) { described_class.new(asciicast) }
|
|
|
|
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.id)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'includes duration' do
|
|
|
|
expect(subject['duration']).to eq(asciicast.duration)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'includes stdout_frames_url' do
|
|
|
|
expect(subject['stdout_frames_url']).to eq(asciicast.stdout_frames_url)
|
|
|
|
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
|