spec/string_security_spec.rb in dionysus-0.2.1 vs spec/string_security_spec.rb in dionysus-0.3.0
- old
+ new
@@ -9,9 +9,27 @@
it "should generate a salt arbitrary nubmer of bytes long" do
String.salt(5).length.should == 5
String.salt(1).length.should == 1
end
+ it "should sanitize the string" do
+ str = 'abcdefg'
+ str.sanitize
+ str.should == ''
+ end
+
+ it "should sanitize the string with 0 passes" do
+ str = 'abcdefg'
+ str.sanitize(0)
+ str.should == ''
+ end
+
+ it "should sanitize the string with 100 passes" do
+ str = 'abcdefg'
+ str.sanitize(100)
+ str.should == ''
+ end
+
it "should calculate sha512 in base64" do
digest = "KHErTuI/5urCF3vi6yTDxvAHBydW1CN3zVfBWDP/ItbmgeVi5IFq47ew0hPHzyK3AuMDh+Z9MBBlf3/mACgVMQ=="
"abcde\240z405".digest(:sha512).should == digest
"abcde\240z405".sha512.should == digest
"abcde\240z405".sha512(:encoding => :base64).should == digest