Sha256: f2c5707b99fd89c21a802cc667523ac9fe9f2a783dea4bee24903c1a5649a9bd
Contents?: true
Size: 1.62 KB
Versions: 3
Compression:
Stored size: 1.62 KB
Contents
require 'spec_helper' require 'squib/args/save_batch' describe Squib::Args::SaveBatch do subject(:save_batch) {Squib::Args::SaveBatch.new} context 'dir' do it 'is created if not exists (and warns)' do opts = { dir: 'tocreate' } Dir.chdir(output_dir) do FileUtils.rm_rf('tocreate', secure: true) expect(Squib.logger).to receive(:warn).with("Dir 'tocreate' does not exist, creating it.").once save_batch.load! opts expect(save_batch).to have_attributes({ dir: ['tocreate'] }) expect(Dir.exists? 'tocreate').to be true end end end context 'rotate' do it 'does nothing by default' do opts = {} save_batch.load! opts expect(save_batch[0]).to have_attributes({ rotate: false, angle: 0 }) end it 'rotates by pi/2 with true' do opts = { rotate: true } save_batch.load! opts expect(save_batch[0]).to have_attributes({ rotate: true, angle: Math::PI / 2 }) end it 'rotates by pi/2' do opts = { rotate: :clockwise } save_batch.load! opts expect(save_batch[0]).to have_attributes({ rotate: true, angle: Math::PI / 2 }) end it 'rotates by pi/2 with counterclockwise' do opts = { rotate: :counterclockwise } save_batch.load! opts expect(save_batch[0]).to have_attributes({ rotate: true, angle: 3 * Math::PI / 2 }) end it 'raises error on a number' do opts = { rotate: 5.0 } expect { save_batch.load!(opts) }.to raise_error('invalid option to rotate: only [true, false, :clockwise, :counterclockwise]') end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
squib-0.12.0 | spec/args/save_batch_spec.rb |
squib-0.11.0 | spec/args/save_batch_spec.rb |
squib-0.10.0 | spec/args/save_batch_spec.rb |