Sha256: 5de9fd30f16f99576a58bc818648e9c5fdb9c4ea6215501c6974374dafd33868

Contents?: true

Size: 794 Bytes

Versions: 6

Compression:

Stored size: 794 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

6 entries across 6 versions & 1 rubygems

Version Path
image_optim-0.31.4 spec/image_optim/worker/jpegrecompress_spec.rb
image_optim-0.31.3 spec/image_optim/worker/jpegrecompress_spec.rb
image_optim-0.31.2 spec/image_optim/worker/jpegrecompress_spec.rb
image_optim-0.31.1 spec/image_optim/worker/jpegrecompress_spec.rb
image_optim-0.31.0 spec/image_optim/worker/jpegrecompress_spec.rb
image_optim-0.30.0 spec/image_optim/worker/jpegrecompress_spec.rb