Sha256: 6de2590d1881cebd90acfdd62b0b2d7abce5f72ea4d526f37c58bdfa053969ae

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require 'helper'

class FileHelpersTest < Test::Unit::TestCase
  include JointTestHelpers

  def setup
    super
    @image  = open_file('mr_t.jpg')
  end

  def teardown
    @image.close
  end

  context ".name" do
    should "return original_filename" do
      def @image.original_filename
        'frank.jpg'
      end
      Joint::FileHelpers.name(@image).should == 'frank.jpg'
    end

    should "fall back to File.basename" do
      Joint::FileHelpers.name(@image).should == 'mr_t.jpg'
    end
  end

  context ".size" do
    should "return size" do
      def @image.size
        25
      end
      Joint::FileHelpers.size(@image).should == 25
    end

    should "fall back to File.size" do
      Joint::FileHelpers.size(@image).should == 13661
    end
  end

  context ".type" do
    should "return type if Joint::Io instance" do
      file = Joint::IO.new(:type => 'image/jpeg')
      Joint::FileHelpers.type(@image).should == 'image/jpeg'
    end

    should "fall back to Wand" do
      Joint::FileHelpers.type(@image).should == 'image/jpeg'
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
associo-0.1.0 test/joint/test_file_helpers.rb