asciinema.org/spec/models/snapshot_spec.rb
2014-08-30 20:10:49 +02:00

33 lines
700 B
Ruby

require 'rails_helper'
describe Snapshot do
let(:snapshot) { described_class.build(data) }
let(:data) { [
[['a', fg: 1], ['b', fg: 2]],
[['ab', fg: 3] ],
[['a', fg: 5], ['b', fg: 6]],
[[' ', {}] , ['' , {}]]
] }
describe '#thumbnail' do
let(:thumbnail) { snapshot.thumbnail(1, 2) }
it 'returns a thumbnail of requested width' do
expect(thumbnail.width).to eq(1)
end
it 'returns a thumbnail of requested height' do
expect(thumbnail.height).to eq(2)
end
it 'crops the grid at the bottom left corner' do
expect(thumbnail.as_json).to eq([
[['a', fg: 3]],
[['a', fg: 5]]
])
end
end
end