Permalink
Browse files

Fix the unit tests.

- The 'setup' method is no longer supported by rspec.
- The '--out' command line argument is no longer supported by rspec.
- The 'spec' task has been modified to run without rcov; rcov is still a
  bit buggy on Ruby 1.9. The 'rcov' task can be used to run the specs
  with rcov.

Signed-off-by: Coda Hale <coda.hale@gmail.com>
  • Loading branch information...
1 parent a41ada9 commit fb7906cdb10739375d5ae0e812e4d01b3a0af3d2 @FooBarWidget FooBarWidget committed with Aug 4, 2009
Showing with 10 additions and 12 deletions.
  1. +6 −8 Rakefile
  2. +1 −1 spec/bcrypt/engine_spec.rb
  3. +3 −3 spec/bcrypt/password_spec.rb
View
@@ -32,19 +32,17 @@ desc "Run all specs"
Spec::Rake::SpecTask.new do |t|
t.spec_files = FileList['spec/**/*_spec.rb']
t.spec_opts = ['--color','--backtrace','--diff']
+end
+
+desc "Run all specs, with coverage testing"
+Spec::Rake::SpecTask.new(:rcov) do |t|
+ t.spec_files = FileList['spec/**/*_spec.rb']
+ t.spec_opts = ['--color','--backtrace','--diff']
t.rcov = true
t.rcov_dir = 'doc/coverage'
t.rcov_opts = ['--exclude', 'spec\/spec,spec\/.*_spec.rb']
end
-namespace :spec do
- desc "Run all specs and store html output in doc/specs.html"
- Spec::Rake::SpecTask.new('html') do |t|
- t.spec_files = FileList['spec/**/*_spec.rb']
- t.spec_opts = ['--diff','--format html','--backtrace','--out doc/specs.html']
- end
-end
-
desc 'Generate RDoc'
rd = Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'doc/rdoc'
@@ -29,7 +29,7 @@
context "Generating BCrypt hashes" do
- setup do
+ before :each do
@salt = BCrypt::Engine.generate_salt(4)
@password = "woo"
end
@@ -2,7 +2,7 @@
context "Creating a hashed password" do
- setup do
+ before :each do
@secret = "wheedle"
@password = BCrypt::Password.create(@secret, :cost => 4)
end
@@ -29,7 +29,7 @@
end
context "Reading a hashed password" do
- setup do
+ before :each do
@secret = "U*U"
@hash = "$2a$05$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW"
end
@@ -48,7 +48,7 @@
end
context "Comparing a hashed password with a secret" do
- setup do
+ before :each do
@secret = "U*U"
@hash = "$2a$05$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW"
@password = BCrypt::Password.create(@secret)

0 comments on commit fb7906c

Please sign in to comment.