Sha256: 0181ea55e42c6bb916c33cc8f8a6840f6bb913d114d6e662b1113d577a609b17

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

RSpec.describe Riiif::ImagemagickCommandFactory do
  let(:path) { 'foo.tiff' }
  let(:info) { double('foo') }

  describe '.command' do
    subject { instance.command }
    let(:instance) { described_class.new(path, info, transformation) }

    let(:transformation) do
      Riiif::Transformation.new(Riiif::Region::Full.new(info),
                                Riiif::Size::Full.new,
                                'quality',
                                'rotation',
                                format)
    end

    context "when it's a jpeg" do
      let(:format) { 'jpg' }
      it { is_expected.to match(/-quality 85/) }
    end

    context "when it's a tiff" do
      let(:format) { 'tif' }
      it { is_expected.not_to match(/-quality/) }
    end

    describe '#external_command' do
      let(:format) { 'jpg' }
      around do |example|
        orig = described_class.external_command
        described_class.external_command = 'gm convert'

        example.run

        described_class.external_command = orig
      end

      it { is_expected.to match(/\Agm convert/) }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
riiif-2.0.0.beta2 spec/services/riiif/imagemagick_command_factory_spec.rb
riiif-2.0.0.beta1 spec/services/riiif/imagemagick_command_factory_spec.rb