Sha256: c78079d2a61bbda5ac61dc5666a2ca308a2fa124a9e89373ee4aa8d4c5552513

Contents?: true

Size: 830 Bytes

Versions: 68

Compression:

Stored size: 830 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
require 'rbbt/util/filecache'
require 'test/unit'

class TestFileCache < Test::Unit::TestCase

  def test_path
    assert_equal(File.join(Rbbt.var.cache.filecache.find(:user),'3','2','1','123.ext'), FileCache.path('123.ext'))
  end

  def test_add_read
    filename = '123.ext'
    content = 'test'

    FileCache.add(filename, content)
    assert_equal(content, File.open(FileCache.path(filename)).read)
    assert_equal(content, FileCache.get(filename).read)

    FileCache.del(filename)
  end

  def test_add_io
    filename = '123.ext'
    content =<<-EOF
test test test
test test test
    EOF

    FileCache.add(filename, StringIO.new(content))
    assert_equal(content, File.open(FileCache.path(filename)).read)

    FileCache.del(filename)
  end

end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
rbbt-util-5.5.47 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.46 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.45 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.44 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.43 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.42 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.41 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.40 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.39 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.38 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.37 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.36 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.35 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.34 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.33 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.32 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.31 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.30 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.29 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.28 test/rbbt/util/test_filecache.rb