asciinema.org/spec/serializers/asciicast_serializer_spec.rb
Marcin Kulik 008545bca8 Revert to direct asciicast JSON URL because Safari is the new IE
Safari fails XHR requests which redirect to other domain (some old CORS
bug they didn't fix for 5 years now)
2016-01-10 19:22:08 +00:00

33 lines
756 B
Ruby

require 'rails_helper'
describe AsciicastSerializer do
let(:serializer) { AsciicastSerializer.new(asciicast, playback_options: PlaybackOptions.new) }
let(:asciicast) { create(:asciicast) }
describe '#to_json' do
subject { JSON.parse(serializer.to_json) }
it 'includes id' do
expect(subject['id']).to eq(asciicast.to_param)
end
it 'includes url' do
expect(subject['url']).to eq(asciicast.file_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