Sha256: f4aa0dad8780733a5b710277e4b4b4d7d52ff0ab87d781626b4c07bf0cfbd567

Contents?: true

Size: 729 Bytes

Versions: 5

Compression:

Stored size: 729 Bytes

Contents

require 'spec_helper'

describe LinkThumbnailer::ImageParsers::Type do

  describe '.perform' do

    let(:type)    { 'png' }
    let(:src)     { 'http://foo.com' }
    let(:image)   { double(src: src) }
    let(:action)  { described_class.perform(image) }

    context 'when no exception is raised' do

      before do
        expect(FastImage).to receive(:type).with(src, raise_on_failure: true).and_return(type)
      end

      it { expect(action).to eq(type) }

    end

    context 'when an exception is raised' do

      before do
        expect(FastImage).to receive(:type).with(src, raise_on_failure: true).and_raise(FastImage::FastImageException)
      end

      it { expect(action).to eq(:jpg) }

    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
link_thumbnailer-2.0.4 spec/image_parsers/type_spec.rb
link_thumbnailer-2.0.3 spec/image_parsers/type_spec.rb
link_thumbnailer-2.0.2 spec/image_parsers/type_spec.rb
link_thumbnailer-2.0.1 spec/image_parsers/type_spec.rb
link_thumbnailer-2.0.0 spec/image_parsers/type_spec.rb