test/tc_fog.rb in crypt-fog-0.1.0 vs test/tc_fog.rb in crypt-fog-1.0.0
- old
+ new
@@ -1,44 +1,51 @@
-###########################
+#############################
# tc_fog.rb
#
# Test suite for crypt-fog.
-###########################
-if File.basename(Dir.pwd) == "test"
- Dir.chdir('..')
+#############################
+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
-$:.unshift Dir.pwd
-$:.unshift Dir.pwd + "/lib"
-
require "test/unit"
require "crypt/fog"
include Crypt
class TC_Fog < Test::Unit::TestCase
def setup
@f = Fog.new("hello")
end
- def test_01_version
- assert_equal("0.1.0",Fog::VERSION,"Bad version")
+ def test_version
+ assert_equal("1.0.0", Fog::VERSION, "Bad version")
end
- def test_02_class_methods
+ def test_constructor
assert_nothing_raised{ Fog.new("string") }
- assert_nothing_raised{ Fog.new("string",55) }
+ 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_nothing_raised{ Fog.decrypt("string", 66) }
+ assert_equal("hello", Fog.decrypt(";8??B", 2003))
end
- def test_03_instance_methods
+ def test_instance_decrypt
+ assert_respond_to(@f, :decrypt)
assert_nothing_raised{ @f.decrypt }
- assert_respond_to(@f,:decrypt)
+ assert_equal("hello", @f.decrypt)
end
- def test_04_types
- assert_equal(Crypt::Fog,@f.class)
- assert_equal(String,@f.decrypt.class)
+ def test_types
+ assert_kind_of(Crypt::Fog, @f)
+ assert_kind_of(String, @f.decrypt)
end
def teardown
@f = nil
end