summaryrefslogtreecommitdiff
path: root/spec/ruby/core/string/crypt_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/string/crypt_spec.rb')
-rw-r--r--spec/ruby/core/string/crypt_spec.rb30
1 files changed, 15 insertions, 15 deletions
diff --git a/spec/ruby/core/string/crypt_spec.rb b/spec/ruby/core/string/crypt_spec.rb
index 06f84c70a4..924b4d48cf 100644
--- a/spec/ruby/core/string/crypt_spec.rb
+++ b/spec/ruby/core/string/crypt_spec.rb
@@ -15,7 +15,7 @@ describe "String#crypt" do
end
it "raises Errno::EINVAL when the salt is shorter than 29 characters" do
- -> { "mypassword".crypt("$2a$04$0WVaz0pV3jzfZ5G5tpmHW") }.should raise_error(Errno::EINVAL)
+ -> { "mypassword".crypt("$2a$04$0WVaz0pV3jzfZ5G5tpmHW") }.should.raise(Errno::EINVAL)
end
it "calls #to_str to converts the salt arg to a String" do
@@ -26,9 +26,9 @@ describe "String#crypt" do
end
it "doesn't return subclass instances" do
- StringSpecs::MyString.new("mypassword").crypt("$2a$04$0WVaz0pV3jzfZ5G5tpmHWu").should be_an_instance_of(String)
- "mypassword".crypt(StringSpecs::MyString.new("$2a$04$0WVaz0pV3jzfZ5G5tpmHWu")).should be_an_instance_of(String)
- StringSpecs::MyString.new("mypassword").crypt(StringSpecs::MyString.new("$2a$04$0WVaz0pV3jzfZ5G5tpmHWu")).should be_an_instance_of(String)
+ StringSpecs::MyString.new("mypassword").crypt("$2a$04$0WVaz0pV3jzfZ5G5tpmHWu").should.instance_of?(String)
+ "mypassword".crypt(StringSpecs::MyString.new("$2a$04$0WVaz0pV3jzfZ5G5tpmHWu")).should.instance_of?(String)
+ StringSpecs::MyString.new("mypassword").crypt(StringSpecs::MyString.new("$2a$04$0WVaz0pV3jzfZ5G5tpmHWu")).should.instance_of?(String)
end
end
@@ -60,7 +60,7 @@ describe "String#crypt" do
end
it "raises an ArgumentError when the string contains NUL character" do
- -> { "poison\0null".crypt("aa") }.should raise_error(ArgumentError)
+ -> { "poison\0null".crypt("aa") }.should.raise(ArgumentError)
end
it "calls #to_str to converts the salt arg to a String" do
@@ -71,22 +71,22 @@ describe "String#crypt" do
end
it "doesn't return subclass instances" do
- StringSpecs::MyString.new("hello").crypt("aa").should be_an_instance_of(String)
- "hello".crypt(StringSpecs::MyString.new("aa")).should be_an_instance_of(String)
- StringSpecs::MyString.new("hello").crypt(StringSpecs::MyString.new("aa")).should be_an_instance_of(String)
+ StringSpecs::MyString.new("hello").crypt("aa").should.instance_of?(String)
+ "hello".crypt(StringSpecs::MyString.new("aa")).should.instance_of?(String)
+ StringSpecs::MyString.new("hello").crypt(StringSpecs::MyString.new("aa")).should.instance_of?(String)
end
it "raises an ArgumentError when the salt is shorter than two characters" do
- -> { "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)
+ -> { "hello".crypt("") }.should.raise(ArgumentError)
+ -> { "hello".crypt("f") }.should.raise(ArgumentError)
+ -> { "hello".crypt("\x00\x00") }.should.raise(ArgumentError)
+ -> { "hello".crypt("\x00a") }.should.raise(ArgumentError)
+ -> { "hello".crypt("a\x00") }.should.raise(ArgumentError)
end
end
it "raises a type error when the salt arg can't be converted to a string" do
- -> { "".crypt(5) }.should raise_error(TypeError)
- -> { "".crypt(mock('x')) }.should raise_error(TypeError)
+ -> { "".crypt(5) }.should.raise(TypeError)
+ -> { "".crypt(mock('x')) }.should.raise(TypeError)
end
end