Sha256: ee81b3e78ab84998518534310a98b8836142627a4117205539c84e7b938c366c

Contents?: true

Size: 873 Bytes

Versions: 16

Compression:

Stored size: 873 Bytes

Contents

require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')

class TestMiscDigest < Test::Unit::TestCase
  def test_digest_str
    o = {:a => [1,2,3], :b => [1.1, 0.00001, 'hola']}
    assert Misc.digest_str(o).include? "hola"
  end

  def test_digest_stream_located
    TmpFile.with_file("TEST") do |filename|
      Open.open(filename) do |f|
        assert_equal 32, Misc.digest_str(f).length
      end
    end
  end

  def test_digest_stream_unlocated
    TmpFile.with_file do |directory|
      Path.setup(directory)
      Open.write(directory.share.file, "TEST")
      Misc.in_dir directory do
        Open.open(Path.setup('share/file')) do |f|
          assert_equal '\'share/file\'', Misc.digest_str(Path.setup('share/file'))
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
scout-essentials-1.3.1 test/scout/misc/test_digest.rb
scout-essentials-1.3.0 test/scout/misc/test_digest.rb
scout-essentials-1.2.0 test/scout/misc/test_digest.rb
scout-essentials-1.1.1 test/scout/misc/test_digest.rb
scout-essentials-1.1.0 test/scout/misc/test_digest.rb
scout-essentials-1.0.0 test/scout/misc/test_digest.rb
scout-gear-9.1.0 test/scout/misc/test_digest.rb
scout-gear-9.0.0 test/scout/misc/test_digest.rb
scout-gear-8.1.0 test/scout/misc/test_digest.rb
scout-gear-8.0.0 test/scout/misc/test_digest.rb
scout-gear-7.3.0 test/scout/misc/test_digest.rb
scout-gear-7.2.0 test/scout/misc/test_digest.rb
scout-gear-7.1.0 test/scout/misc/test_digest.rb
scout-gear-6.0.0 test/scout/misc/test_digest.rb
scout-gear-5.2.0 test/scout/misc/test_digest.rb
scout-gear-5.1.1 test/scout/misc/test_digest.rb