asciinema.org/spec/models/snapshot_spec.rb

33 lines
699 B
Ruby
Raw Normal View History

require 'spec_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]],
[[' ', {}] , ['' , {}]]
] }
2013-08-25 18:49:23 +00:00
describe '#thumbnail' do
let(:thumbnail) { snapshot.thumbnail(1, 2) }
it 'returns a thumbnail of requested width' do
expect(thumbnail.width).to eq(1)
2013-08-25 18:49:23 +00:00
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
2013-08-25 18:49:23 +00:00
end