Skip to content

Commit

Permalink
Switch to rspec.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnunemaker committed Oct 10, 2012
1 parent 3799f65 commit ce34872
Show file tree
Hide file tree
Showing 17 changed files with 1,705 additions and 1,739 deletions.
4 changes: 1 addition & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ group(:debug) do
end

group(:test) do
gem 'shoulda', '~> 2.11'
gem 'jnunemaker-matchy', '~> 0.4.0', :require => 'matchy'
gem 'mocha', '~> 0.9.8'
gem 'rspec'
gem 'log_buddy'
end
20 changes: 3 additions & 17 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
require 'rubygems'
require 'rake'
require 'rake/testtask'
require File.expand_path('../lib/plucky/version', __FILE__)

require 'bundler'
Bundler::GemHelper.install_tasks

namespace :test do
Rake::TestTask.new(:all) do |test|
test.libs << 'lib' << 'test'
test.pattern = 'test/**/test_*.rb'
test.verbose = true
end
end

task :test do
Rake::Task['test:all'].invoke
end
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new

task :default => :test
task :default => :spec
24 changes: 14 additions & 10 deletions test/helper.rb → spec/helper.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
$:.unshift(File.expand_path('../../lib', __FILE__))

require 'rubygems'
require 'bundler'

Bundler.require(:default, :test)

$:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
require 'plucky'

require 'fileutils'
require 'logger'
require 'pp'
require 'set'

log_dir = File.expand_path('../../log', __FILE__)
FileUtils.mkdir_p(log_dir)
Expand All @@ -20,21 +20,25 @@
connection = Mongo::Connection.new('127.0.0.1', 27017, :logger => Log)
DB = connection.db('test')

class Test::Unit::TestCase
def setup
DB.collections.map do |collection|
collection.remove
collection.drop_indexes
end
end

module OrderedHashHelpers
def oh(*args)
BSON::OrderedHash.new.tap do |hash|
args.each { |a| hash[a[0]] = a[1] }
end
end
end

RSpec.configure do |c|
c.include OrderedHashHelpers

c.before(:each) do
DB.collections.map do |collection|
collection.remove
collection.drop_indexes
end
end
end

operators = %w{gt lt gte lte ne in nin mod all size exists}
operators.delete('size') if RUBY_VERSION >= '1.9.1'
SymbolOperators = operators
Loading

0 comments on commit ce34872

Please sign in to comment.