Sha256: 34eec67f7153a01246b190bcfef06b07079093b67cacf39ff01692c54b6e81fa

Contents?: true

Size: 1.13 KB

Versions: 12

Compression:

Stored size: 1.13 KB

Contents

require "spec_helper"

describe Paperclip::GeometryDetector do
  it "identifies an image and extract its dimensions" do
    allow_any_instance_of(Paperclip::GeometryParser).to receive(:make).and_return(:correct)
    file = fixture_file("5k.png")
    factory = Paperclip::GeometryDetector.new(file)

    output = factory.make

    expect(output).to eq :correct
  end

  it "identifies an image and extract its dimensions and orientation" do
    allow_any_instance_of(Paperclip::GeometryParser).to receive(:make).and_return(:correct)
    file = fixture_file("rotated.jpg")
    factory = Paperclip::GeometryDetector.new(file)

    output = factory.make

    expect(output).to eq :correct
  end

  it "avoids reading EXIF orientation if so configured" do
    begin
      Paperclip.options[:use_exif_orientation] = false
      allow_any_instance_of(Paperclip::GeometryParser).to receive(:make).and_return(:correct)
      file = fixture_file("rotated.jpg")
      factory = Paperclip::GeometryDetector.new(file)

      output = factory.make

      expect(output).to eq :correct
    ensure
      Paperclip.options[:use_exif_orientation] = true
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
kt-paperclip-7.2.0 spec/paperclip/geometry_detector_spec.rb
kt-paperclip-6.4.2 spec/paperclip/geometry_detector_spec.rb
kt-paperclip-7.1.1 spec/paperclip/geometry_detector_spec.rb
kt-paperclip-7.1.0 spec/paperclip/geometry_detector_spec.rb
kt-paperclip-7.0.1 spec/paperclip/geometry_detector_spec.rb
kt-paperclip-7.0.0 spec/paperclip/geometry_detector_spec.rb
kt-paperclip-6.4.1 spec/paperclip/geometry_detector_spec.rb
kt-paperclip-6.4.0 spec/paperclip/geometry_detector_spec.rb
kt-paperclip-6.3.0 spec/paperclip/geometry_detector_spec.rb
kt-paperclip-6.2.2 spec/paperclip/geometry_detector_spec.rb
kt-paperclip-6.2.1 spec/paperclip/geometry_detector_spec.rb
kt-paperclip-6.2.0 spec/paperclip/geometry_detector_spec.rb