Sha256: e1db25644bbdd4d30f4c2c2db7e51a4e14755cd3446c5519cb3b8dbf0c83d939

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

require 'rubygems'
require 'test/unit'
require File.expand_path('../../lib/mini_magick', __FILE__)

class CommandBuilderTest < Test::Unit::TestCase
  include MiniMagick

  def test_basic
    c = CommandBuilder.new("test")
    c.resize "30x40"
    assert_equal "-resize 30x40", c.args.join(" ")
  end

  def test_complicated
    c = CommandBuilder.new("test")
    c.resize "30x40"
    c.alpha 1, 3, 4
    c.resize "mome fingo"
    assert_equal "-resize 30x40 -alpha 1 3 4 -resize \"mome fingo\"", c.args.join(" ")
  end
  
  def test_valid_command
    begin
      c = CommandBuilder.new("test", "path")
      c.input 2
      assert false
    rescue NoMethodError
      assert true
    end
  end
  
  def test_full_command
    c = CommandBuilder.new("test")
    c.resize "30x40"
    c.alpha 1, 3, 4
    c.resize "mome fingo"
    assert_equal "test -resize 30x40 -alpha 1 3 4 -resize \"mome fingo\"", c.command
  end

  def test_dashed
    c = CommandBuilder.new("test")
    c.auto_orient
    assert_equal "-auto-orient", c.args.join(" ")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mini_magick-2.0.0 test/command_builder_test.rb