1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2019-07-27 12:40:09 +02:00
parent a06301b103
commit 5c276e1cc9
1247 changed files with 5316 additions and 5028 deletions

View file

@ -15,7 +15,7 @@ describe "String#crypt" do
end
it "raises Errno::EINVAL when the salt is shorter than 29 characters" do
lambda { "mypassword".crypt("$2a$04$0WVaz0pV3jzfZ5G5tpmHW") }.should raise_error(Errno::EINVAL)
-> { "mypassword".crypt("$2a$04$0WVaz0pV3jzfZ5G5tpmHW") }.should raise_error(Errno::EINVAL)
end
it "calls #to_str to converts the salt arg to a String" do
@ -73,7 +73,7 @@ describe "String#crypt" do
end
it "raises an ArgumentError when the string contains NUL character" do
lambda { "poison\0null".crypt("aa") }.should raise_error(ArgumentError)
-> { "poison\0null".crypt("aa") }.should raise_error(ArgumentError)
end
it "calls #to_str to converts the salt arg to a String" do
@ -103,16 +103,16 @@ describe "String#crypt" do
end
it "raises an ArgumentError when the salt is shorter than two characters" do
lambda { "hello".crypt("") }.should raise_error(ArgumentError)
lambda { "hello".crypt("f") }.should raise_error(ArgumentError)
lambda { "hello".crypt("\x00\x00") }.should raise_error(ArgumentError)
lambda { "hello".crypt("\x00a") }.should raise_error(ArgumentError)
lambda { "hello".crypt("a\x00") }.should raise_error(ArgumentError)
-> { "hello".crypt("") }.should raise_error(ArgumentError)
-> { "hello".crypt("f") }.should raise_error(ArgumentError)
-> { "hello".crypt("\x00\x00") }.should raise_error(ArgumentError)
-> { "hello".crypt("\x00a") }.should raise_error(ArgumentError)
-> { "hello".crypt("a\x00") }.should raise_error(ArgumentError)
end
end
it "raises a type error when the salt arg can't be converted to a string" do
lambda { "".crypt(5) }.should raise_error(TypeError)
lambda { "".crypt(mock('x')) }.should raise_error(TypeError)
-> { "".crypt(5) }.should raise_error(TypeError)
-> { "".crypt(mock('x')) }.should raise_error(TypeError)
end
end