Sha256: 256cfe3dd95746e0ed1e4103020cb7325f0e6611b33989cc22e9a0b8a0984fd0

Contents?: true

Size: 855 Bytes

Versions: 3

Compression:

Stored size: 855 Bytes

Contents

# -*- coding: utf-8 -*-
require "sixarm_ruby_magic_number_type_test"

describe File do

  before do
    SAMPLE_FILE_NAME_TO_MAGIC_NUMBER_TYPE ||= {
      'sample.fit' => :fits,
      'sample.gif' => :gif,
      'sample.html' => :html,
      'sample.xml' => :xml,
      'sample.jpg' => :jpeg,
      'sample.png' => :png,
      'sample.ps' => :postscript,
      'sample.ras' => :sun_rasterfile,
      'sample.sgi' => :iris_rgb,
      'sample.tiff' => :tiff,
      'sample.bz2' => :bzip,
      'sample.gz' => :gzip,
    }
  end

  it "solves the magic number type" do
    SAMPLE_FILE_NAME_TO_MAGIC_NUMBER_TYPE.each_pair{|file_name, type|
      path = File.join("test","sixarm_ruby_magic_number_type_test","samples",file_name)
      File.exist?(path).must_equal true
      File.magic_number_type(path).must_equal type, "Trying #{file_name}"
    }
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sixarm_ruby_magic_number_type-3.0.0 test/sixarm_ruby_magic_number_type_test/file_test.rb
sixarm_ruby_magic_number_type-2.0.5 test/sixarm_ruby_magic_number_type_test/file_test.rb
sixarm_ruby_magic_number_type-2.0.4 test/sixarm_ruby_magic_number_type_test/file_test.rb