############################# # tc_fog.rb # # Test suite for crypt-fog. ############################# base = File.basename(Dir.pwd) if base == "test" || base =~ /crypt-fog/ Dir.chdir("..") if base == "test" $LOAD_PATH.unshift Dir.pwd $LOAD_PATH.unshift Dir.pwd + "/lib" end require "test/unit" require "crypt/fog" include Crypt class TC_Fog < Test::Unit::TestCase def setup @f = Fog.new("hello") end def test_version assert_equal("1.0.0", Fog::VERSION, "Bad version") end def test_constructor assert_nothing_raised{ Fog.new("string") } assert_nothing_raised{ Fog.new("string", 55) } end def test_class_decrypt assert_respond_to(Fog, :decrypt) assert_nothing_raised{ Fog.decrypt("string") } assert_nothing_raised{ Fog.decrypt("string", 66) } assert_equal("hello", Fog.decrypt(";8??B", 2003)) end def test_instance_decrypt assert_respond_to(@f, :decrypt) assert_nothing_raised{ @f.decrypt } assert_equal("hello", @f.decrypt) end def test_types assert_kind_of(Crypt::Fog, @f) assert_kind_of(String, @f.decrypt) end def teardown @f = nil end end