Sha256: ce8a5a0460fdf2c57b365504ff3c51a773facfcf58721db77456523f14a3870a

Contents?: true

Size: 1020 Bytes

Versions: 5

Compression:

Stored size: 1020 Bytes

Contents

require 'spec_helper'

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

  describe '.build' do
    subject { described_class.build(path, transformation) }

    let(:transformation) do
      Riiif::Transformation.new('region',
                                'size',
                                '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

5 entries across 5 versions & 1 rubygems

Version Path
riiif-1.7.1 spec/services/riiif/imagemagick_command_factory_spec.rb
riiif-1.7.0 spec/services/riiif/imagemagick_command_factory_spec.rb
riiif-1.6.0 spec/services/riiif/imagemagick_command_factory_spec.rb
riiif-1.5.1 spec/services/riiif/imagemagick_command_factory_spec.rb
riiif-1.5.0 spec/services/riiif/imagemagick_command_factory_spec.rb