Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Switch to rspec2

  • Loading branch information...
commit 6c505b307a8afcab6398a29b7198be39b9b9c711 1 parent 1965feb
@tmm1 tmm1 authored
View
3  .rspec
@@ -0,0 +1,3 @@
+--color
+--backtrace
+--format documentation
View
16 Rakefile
@@ -1,11 +1,11 @@
-require "spec/rake/spectask"
+require 'rspec/core/rake_task'
require 'rake/gempackagetask'
require 'rake/extensiontask'
require 'rake/javaextensiontask'
require 'rake/contrib/rubyforgepublisher'
require 'rake/clean'
require 'rake/rdoctask'
-require "benchmark"
+require 'benchmark'
PKG_NAME = "bcrypt-ruby"
PKG_VERSION = "2.1.2"
@@ -34,17 +34,15 @@ CLOBBER.include(
task :default => [:compile, :spec]
desc "Run all specs"
-Spec::Rake::SpecTask.new do |t|
- t.spec_files = FileList['spec/**/*_spec.rb']
- t.spec_opts = ['--color','--backtrace','--diff']
+RSpec::Core::RakeTask.new do |t|
+ t.pattern = 'spec/**/*_spec.rb'
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']
+RSpec::Core::RakeTask.new(:rcov) do |t|
+ t.pattern = 'spec/**/*_spec.rb'
t.rcov = true
- t.rcov_dir = 'doc/coverage'
+ t.rcov_path = 'doc/coverage'
t.rcov_opts = ['--exclude', 'rspec,diff-lcs,rcov,_spec,_helper']
end
View
8 spec/bcrypt/engine_spec.rb
@@ -1,6 +1,6 @@
require File.expand_path(File.join(File.dirname(__FILE__), "..", "spec_helper"))
-context "The BCrypt engine" do
+describe "The BCrypt engine" do
specify "should calculate the optimal cost factor to fit in a specific time" do
first = BCrypt::Engine.calibrate(100)
second = BCrypt::Engine.calibrate(400)
@@ -8,7 +8,7 @@
end
end
-context "Generating BCrypt salts" do
+describe "Generating BCrypt salts" do
specify "should produce strings" do
BCrypt::Engine.generate_salt.should be_an_instance_of(String)
@@ -27,7 +27,7 @@
end
end
-context "Autodetecting of salt cost" do
+describe "Autodetecting of salt cost" do
specify "should work" do
BCrypt::Engine.autodetect_cost("$2a$08$hRx2IVeHNsTSYYtUWn61Ou").should == 8
@@ -37,7 +37,7 @@
end
-context "Generating BCrypt hashes" do
+describe "Generating BCrypt hashes" do
class MyInvalidSecret
undef to_s
View
8 spec/bcrypt/password_spec.rb
@@ -1,6 +1,6 @@
require File.expand_path(File.join(File.dirname(__FILE__), "..", "spec_helper"))
-context "Creating a hashed password" do
+describe "Creating a hashed password" do
before :each do
@secret = "wheedle"
@@ -28,7 +28,7 @@
end
end
-context "Reading a hashed password" do
+describe "Reading a hashed password" do
before :each do
@secret = "U*U"
@hash = "$2a$05$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW"
@@ -47,7 +47,7 @@
end
end
-context "Comparing a hashed password with a secret" do
+describe "Comparing a hashed password with a secret" do
before :each do
@secret = "U*U"
@hash = "$2a$05$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW"
@@ -61,4 +61,4 @@
specify "should compare unsuccessfully to anything besides original secret" do
(@password == "@secret").should be(false)
end
-end
+end
View
6 spec/spec_helper.rb
@@ -1,4 +1,2 @@
-$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
-require "rubygems"
-require "spec"
-require "bcrypt"
+$:.unshift File.expand_path('../../lib', __FILE__)
+require 'bcrypt'
Please sign in to comment.
Something went wrong with that request. Please try again.