asciinema.org/spec/serializers/asciicast_serializer_spec.rb

37 lines
849 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
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.to_param)
2013-10-20 15:03:20 +00:00
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
end
end