Sha256: 76d2b41e7159eb1f0211c2643b9e109769524d5d49f7b0829809cc23073dfd8c

Contents?: true

Size: 800 Bytes

Versions: 2

Compression:

Stored size: 800 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'
require 'image_optim/worker/jpegrecompress'

describe ImageOptim::Worker::Jpegrecompress do
  describe 'method value' do
    let(:subject){ described_class.new(ImageOptim.new, method).method }

    context 'default' do
      let(:method){ {} }

      it{ is_expected.to eq('ssim') }
    end

    context 'uses default when invalid' do
      let(:method){ {:method => 'invalid'} }

      it 'warns and keeps default' do
        expect_any_instance_of(described_class).
          to receive(:warn).with('Unknown method for jpegrecompress: invalid')
        is_expected.to eq('ssim')
      end
    end

    context 'can use a valid option' do
      let(:method){ {:method => 'smallfry'} }

      it{ is_expected.to eq('smallfry') }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
image_optim-0.29.0 spec/image_optim/worker/jpegrecompress_spec.rb
image_optim-0.28.0 spec/image_optim/worker/jpegrecompress_spec.rb