Sha256: 6f6ff1f4b6e5b5ec12d24ce6c278a1b9e3bd2dde2015535bcdae1255562a5485

Contents?: true

Size: 1.86 KB

Versions: 11

Compression:

Stored size: 1.86 KB

Contents

require './test/helper'

class GeometryParserTest < Test::Unit::TestCase
  should 'identify 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

  should 'identify 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

  should 'identify 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

  should 'identify 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

  should 'identify 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

11 entries across 11 versions & 1 rubygems

Version Path
paperclip-4.1.1 test/geometry_parser_test.rb
paperclip-4.1.0 test/geometry_parser_test.rb
paperclip-3.5.4 test/geometry_parser_test.rb
paperclip-4.0.0 test/geometry_parser_test.rb
paperclip-3.5.3 test/geometry_parser_test.rb
paperclip-3.5.2 test/geometry_parser_test.rb
paperclip-3.5.1 test/geometry_parser_test.rb
paperclip-3.5.0 test/geometry_parser_test.rb
paperclip-3.4.2 test/geometry_parser_test.rb
paperclip-3.4.1 test/geometry_parser_test.rb
paperclip-3.4.0 test/geometry_parser_test.rb