Commit 8b90c357e99debc6e49cef5bf027c1034d12a097
Added another spec for generating salts.
Reduced the cost of spec'd passwords to 4, to speed up spec execution. git-svn-id: http://bcrypt-ruby.rubyforge.org/svn/trunk@13 b1e0f299-433e-4bb3-9895-84128a6cfb6acodahale committed on 2/28/2007, 6:36:55 AM
Parent: 024b702838a0d932e17d91cbd0a1c939c9c3a296
Files changed
spec/bcrypt/engine_spec.rb | changed |
spec/bcrypt/password_spec.rb | changed |
spec/bcrypt/engine_spec.rb | ||
---|---|---|
@@ -20,14 +20,18 @@ | ||
20 | 20 … | |
21 | 21 … | specify "should raise a InvalidCostError if the cost parameter isn't numeric" do |
22 | 22 … | lambda { BCrypt::Engine.generate_salt('woo') }.should raise_error(BCrypt::Errors::InvalidCost) |
23 | 23 … | end |
24 … | + | |
25 … | + specify "should raise a InvalidCostError if the cost parameter isn't greater than 0" do | |
26 … | + lambda { BCrypt::Engine.generate_salt(-1) }.should raise_error(BCrypt::Errors::InvalidCost) | |
27 … | + end | |
24 | 28 … | end |
25 | 29 … | |
26 | 30 … | context "Generating BCrypt hashes" do |
27 | 31 … | |
28 | 32 … | setup do |
29 | - @salt = BCrypt::Engine.generate_salt(5) | |
33 … | + @salt = BCrypt::Engine.generate_salt(4) | |
30 | 34 … | @password = "woo" |
31 | 35 … | end |
32 | 36 … | |
33 | 37 … | specify "should produce a string" do |
spec/bcrypt/password_spec.rb | ||
---|---|---|
@@ -3,9 +3,9 @@ | ||
3 | 3 … | context "Creating a hashed password" do |
4 | 4 … | |
5 | 5 … | setup do |
6 | 6 … | @secret = "wheedle" |
7 | - @password = BCrypt::Password.create(@secret) | |
7 … | + @password = BCrypt::Password.create(@secret, :cost => 4) | |
8 | 8 … | end |
9 | 9 … | |
10 | 10 … | specify "should return a BCrypt::Password" do |
11 | 11 … | @password.should be_an_instance_of(BCrypt::Password) |
Built with git-ssb-web