Sha256: 8390871658e380c9bc5d4189ff240940abe92e59a7894d4fb2dd35e820afcbb7

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

#############################################################################
# test_win32_file_encryption.rb
#
# Test case for the encryption related methods of win32-file. You should
# run this test via the 'rake test' or 'rake test_encryption' task.
# 
# Note: These tests may fail based on the security setup of your system.
#############################################################################
require 'rubygems'
gem 'test-unit'

require 'test/unit'
require 'win32/file'

class TC_Win32_File_Encryption < Test::Unit::TestCase
   def self.startup
      Dir.chdir('test') unless File.basename(Dir.pwd) == 'test'
      @@file = File.join(Dir.pwd, 'encryption_test.txt')
      File.open(@@file, 'w'){ |fh| fh.puts "This is an encryption test." }
   end

   def setup
      @msg = '=> Ignore. May not work due to security setup of your system.'
   end
   
   def test_encrypt
      assert_respond_to(File, :encrypt)
      assert_nothing_raised(@msg){ File.encrypt(@@file) }
   end
   
   def test_decrypt
      assert_respond_to(File, :decrypt)
      assert_nothing_raised(@msg){ File.decrypt(@@file) }
   end
   
   def teardown
      @msg = nil
   end

   def self.shutdown
      File.delete(@@file) if File.exists?(@@file)
      @@file = nil
   end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
win32-file-0.6.0 test/test_win32_file_encryption.rb
win32-file-0.6.1 test/test_win32_file_encryption.rb
win32-file-0.5.6 test/test_win32_file_encryption.rb