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.27 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.26 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.25 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.24 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.23 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.22 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.21 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.20 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.19 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.18 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.17 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.16 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.15 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.14 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.13 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.12 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.11 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.10 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.9 test/rbbt/util/test_filecache.rb
rbbt-util-5.5.8 test/rbbt/util/test_filecache.rb