Sha256: e2c3f2a7e72d9334d58249578a96f3303afc0baf841a6b3ef8733858d0a95266

Contents?: true

Size: 1.78 KB

Versions: 32

Compression:

Stored size: 1.78 KB

Contents

require 'spec_helper'

describe Paperclip::GeometryParser do
  it 'identifies an image and extract its dimensions with no orientation' do
    Paperclip::Geometry.stubs(:new).with(
      height: '73',
      width: '434',
      modifier: nil,
      orientation: nil
    ).returns(:correct)
    factory = Paperclip::GeometryParser.new("434x73")

    output = factory.make

    assert_equal :correct, output
  end

  it 'identifies an image and extract its dimensions with an empty orientation' do
    Paperclip::Geometry.stubs(:new).with(
      height: '73',
      width: '434',
      modifier: nil,
      orientation: ''
    ).returns(:correct)
    factory = Paperclip::GeometryParser.new("434x73,")

    output = factory.make

    assert_equal :correct, output
  end

  it 'identifies an image and extract its dimensions and orientation' do
    Paperclip::Geometry.stubs(:new).with(
      height: '200',
      width: '300',
      modifier: nil,
      orientation: '6'
    ).returns(:correct)
    factory = Paperclip::GeometryParser.new("300x200,6")

    output = factory.make

    assert_equal :correct, output
  end

  it 'identifies an image and extract its dimensions and modifier' do
    Paperclip::Geometry.stubs(:new).with(
      height: '64',
      width: '64',
      modifier: '#',
      orientation: nil
    ).returns(:correct)
    factory = Paperclip::GeometryParser.new("64x64#")

    output = factory.make

    assert_equal :correct, output
  end

  it 'identifies an image and extract its dimensions, orientation, and modifier' do
    Paperclip::Geometry.stubs(:new).with(
      height: '50',
      width: '100',
      modifier: '>',
      orientation: '7'
    ).returns(:correct)
    factory = Paperclip::GeometryParser.new("100x50,7>")

    output = factory.make

    assert_equal :correct, output
  end
end

Version data entries

32 entries across 30 versions & 6 rubygems

Version Path
kt-paperclip-5.4.0 spec/paperclip/geometry_parser_spec.rb
kt-paperclip-4.4.0 spec/paperclip/geometry_parser_spec.rb
paperclip-6.1.0 spec/paperclip/geometry_parser_spec.rb
paperclip-6.0.0 spec/paperclip/geometry_parser_spec.rb
paperclip-5.3.0 spec/paperclip/geometry_parser_spec.rb
paperclip-5.2.1 spec/paperclip/geometry_parser_spec.rb
paperclip-5.2.0 spec/paperclip/geometry_parser_spec.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/paperclip-5.1.0/spec/paperclip/geometry_parser_spec.rb
paperclip-5.1.0 spec/paperclip/geometry_parser_spec.rb
paperclip-5.0.0 spec/paperclip/geometry_parser_spec.rb
paperclip-4.3.7 spec/paperclip/geometry_parser_spec.rb
paperclip_jk-5.0.0.beta2 spec/paperclip/geometry_parser_spec.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/paperclip-4.3.6/spec/paperclip/geometry_parser_spec.rb
paperclip-5.0.0.beta2 spec/paperclip/geometry_parser_spec.rb
paperclip-5.0.0.beta1 spec/paperclip/geometry_parser_spec.rb
paperclip-4.3.6 spec/paperclip/geometry_parser_spec.rb
paperclip-4.3.5 spec/paperclip/geometry_parser_spec.rb
paperclip-4.3.4 spec/paperclip/geometry_parser_spec.rb
paperclip-4.3.3 spec/paperclip/geometry_parser_spec.rb
paperclip-4.3.2 spec/paperclip/geometry_parser_spec.rb