git ssb

0+

dangerousbeans / %aPBe2k3ugtjBr4rrsU1…



Commit 6c505b307a8afcab6398a29b7198be39b9b9c711

Switch to rspec2

Aman Gupta committed on 12/20/2010, 6:39:30 PM
Parent: 1965feb04521deb88687096017f69da1bd59d952

Files changed

Rakefilechanged
spec/bcrypt/engine_spec.rbchanged
spec/bcrypt/password_spec.rbchanged
spec/spec_helper.rbchanged
.rspecadded
RakefileView
@@ -1,12 +1,12 @@
1-require "spec/rake/spectask"
1+require 'rspec/core/rake_task'
22 require 'rake/gempackagetask'
33 require 'rake/extensiontask'
44 require 'rake/javaextensiontask'
55 require 'rake/contrib/rubyforgepublisher'
66 require 'rake/clean'
77 require 'rake/rdoctask'
8-require "benchmark"
8+require 'benchmark'
99
1010 PKG_NAME = "bcrypt-ruby"
1111 PKG_VERSION = "2.1.2"
1212 PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
@@ -33,19 +33,17 @@
3333
3434 task :default => [:compile, :spec]
3535
3636 desc "Run all specs"
37-Spec::Rake::SpecTask.new do |t|
38- t.spec_files = FileList['spec/**/*_spec.rb']
39- t.spec_opts = ['--color','--backtrace','--diff']
37+RSpec::Core::RakeTask.new do |t|
38+ t.pattern = 'spec/**/*_spec.rb'
4039 end
4140
4241 desc "Run all specs, with coverage testing"
43-Spec::Rake::SpecTask.new(:rcov) do |t|
44- t.spec_files = FileList['spec/**/*_spec.rb']
45- t.spec_opts = ['--color','--backtrace','--diff']
42+RSpec::Core::RakeTask.new(:rcov) do |t|
43+ t.pattern = 'spec/**/*_spec.rb'
4644 t.rcov = true
47- t.rcov_dir = 'doc/coverage'
45+ t.rcov_path = 'doc/coverage'
4846 t.rcov_opts = ['--exclude', 'rspec,diff-lcs,rcov,_spec,_helper']
4947 end
5048
5149 desc 'Generate RDoc'
spec/bcrypt/engine_spec.rbView
@@ -1,15 +1,15 @@
11 require File.expand_path(File.join(File.dirname(__FILE__), "..", "spec_helper"))
22
3-context "The BCrypt engine" do
3+describe "The BCrypt engine" do
44 specify "should calculate the optimal cost factor to fit in a specific time" do
55 first = BCrypt::Engine.calibrate(100)
66 second = BCrypt::Engine.calibrate(400)
77 second.should > first
88 end
99 end
1010
11-context "Generating BCrypt salts" do
11+describe "Generating BCrypt salts" do
1212
1313 specify "should produce strings" do
1414 BCrypt::Engine.generate_salt.should be_an_instance_of(String)
1515 end
@@ -26,9 +26,9 @@
2626 lambda { BCrypt::Engine.generate_salt(-1) }.should raise_error(BCrypt::Errors::InvalidCost)
2727 end
2828 end
2929
30-context "Autodetecting of salt cost" do
30+describe "Autodetecting of salt cost" do
3131
3232 specify "should work" do
3333 BCrypt::Engine.autodetect_cost("$2a$08$hRx2IVeHNsTSYYtUWn61Ou").should == 8
3434 BCrypt::Engine.autodetect_cost("$2a$05$XKd1bMnLgUnc87qvbAaCUu").should == 5
@@ -36,9 +36,9 @@
3636 end
3737
3838 end
3939
40-context "Generating BCrypt hashes" do
40+describe "Generating BCrypt hashes" do
4141
4242 class MyInvalidSecret
4343 undef to_s
4444 end
spec/bcrypt/password_spec.rbView
@@ -1,7 +1,7 @@
11 require File.expand_path(File.join(File.dirname(__FILE__), "..", "spec_helper"))
22
3-context "Creating a hashed password" do
3+describe "Creating a hashed password" do
44
55 before :each do
66 @secret = "wheedle"
77 @password = BCrypt::Password.create(@secret, :cost => 4)
@@ -27,9 +27,9 @@
2727 lambda { BCrypt::Password.create( String.new ) }.should_not raise_error
2828 end
2929 end
3030
31-context "Reading a hashed password" do
31+describe "Reading a hashed password" do
3232 before :each do
3333 @secret = "U*U"
3434 @hash = "$2a$05$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW"
3535 end
@@ -46,9 +46,9 @@
4646 lambda { BCrypt::Password.new('weedle') }.should raise_error(BCrypt::Errors::InvalidHash)
4747 end
4848 end
4949
50-context "Comparing a hashed password with a secret" do
50+describe "Comparing a hashed password with a secret" do
5151 before :each do
5252 @secret = "U*U"
5353 @hash = "$2a$05$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW"
5454 @password = BCrypt::Password.create(@secret)
@@ -60,5 +60,5 @@
6060
6161 specify "should compare unsuccessfully to anything besides original secret" do
6262 (@password == "@secret").should be(false)
6363 end
64-end
64+end
spec/spec_helper.rbView
@@ -1,4 +1,2 @@
1-$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
2-require "rubygems"
3-require "spec"
4-require "bcrypt"
1+$:.unshift File.expand_path('../../lib', __FILE__)
2+require 'bcrypt'
.rspecView
@@ -1,0 +1,3 @@
1+--color
2+--backtrace
3+--format documentation

Built with git-ssb-web