You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
asciinema.org/spec/models/snapshot_spec.rb

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