Sha256: 2d4d724acee1113d01a6af8b00e9de68acf32d0908e5609973f20c14f0bdcdbc

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

require "mireru2/container"

class ContainerTest < Test::Unit::TestCase
  def setup
    @container = Mireru2::Container.new
  end

  def test_size
    assert_equal(0, @container.size)
    files = @container.instance_variable_get(:@files)
    files << __FILE__
    assert_equal(1, @container.size)
    files << __FILE__
    assert_equal(2, @container.size)
  end

  def test_no_argument
    valid = @container.__send__(:file?, nil)
    assert_false(valid)
  end

  def test_missing_file
    valid = @container.__send__(:file?, "hoge")
    assert_false(valid)
  end

  def test_no_extention_file_type
    file = File.join(File.dirname(__FILE__), "fixtures", "no-extention")
    valid = @container.__send__(:file?, file)
    assert_true(valid)
  end

  def test_png_file
    file = File.join(File.dirname(__FILE__), "fixtures", "nijip.png")
    valid = @container.__send__(:file?, file)
    assert_true(valid)
  end

  def test_txt_file
    file = File.join(File.dirname(__FILE__), "fixtures", "LICENSE.txt")
    valid = @container.__send__(:file?, file)
    assert_true(valid)
  end

  def test_rb_file
    file = File.join(File.dirname(__FILE__), "fixtures", "nijip.rb")
    valid = @container.__send__(:file?, file)
    assert_true(valid)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mireru2-0.0.1 test/test-container.rb