Permalink
Browse files

setting up spec boilerplate

  • Loading branch information...
1 parent a977e26 commit 5a490803ba100bf838d3bca353081d46a885c383 @aaw aaw committed Apr 1, 2011
Showing with 90 additions and 64 deletions.
  1. +11 −11 .gitignore
  2. +3 −2 Gemfile
  3. +30 −4 Gemfile.lock
  4. +5 −22 Rakefile
  5. +7 −0 spec/models/artist.rb
  6. +7 −0 spec/models/artwork.rb
  7. +7 −0 spec/mongoid/fulltext_spec.rb
  8. +20 −0 spec/spec_helper.rb
  9. +0 −18 test/helper.rb
  10. +0 −7 test/test_mongoid_fulltext.rb
View
@@ -26,17 +26,17 @@ pkg
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
#
# For MacOS:
-#
-#.DS_Store
-#
+
+.DS_Store
+
# For TextMate
-#*.tmproj
-#tmtags
-#
+*.tmproj
+tmtags
+
# For emacs:
-#*~
-#\#*
-#.\#*
-#
+*~
+\#*
+.\#*
+
# For vim:
-#*.swp
+*.swp
View
@@ -6,8 +6,9 @@ source "http://rubygems.org"
# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
group :development do
- gem "shoulda", ">= 0"
+ gem "mongoid", "2.0.0.rc.7"
+ gem 'database_cleaner', '~> 0.6.0'
+ gem 'rspec', '~> 2.5.0'
gem "bundler", "~> 1.0.0"
gem "jeweler", "~> 1.5.2"
- gem "rcov", ">= 0"
end
View
@@ -1,20 +1,46 @@
GEM
remote: http://rubygems.org/
specs:
+ activemodel (3.0.5)
+ activesupport (= 3.0.5)
+ builder (~> 2.1.2)
+ i18n (~> 0.4)
+ activesupport (3.0.5)
+ bson (1.2.4)
+ builder (2.1.2)
+ database_cleaner (0.6.6)
+ diff-lcs (1.1.2)
git (1.2.5)
+ i18n (0.5.0)
jeweler (1.5.2)
bundler (~> 1.0.0)
git (>= 1.2.5)
rake
+ mongo (1.2.4)
+ bson (>= 1.2.4)
+ mongoid (2.0.0.rc.7)
+ activemodel (~> 3.0)
+ mongo (~> 1.2)
+ tzinfo (~> 0.3.22)
+ will_paginate (~> 3.0.pre)
rake (0.8.7)
- rcov (0.9.9)
- shoulda (2.11.3)
+ rspec (2.5.0)
+ rspec-core (~> 2.5.0)
+ rspec-expectations (~> 2.5.0)
+ rspec-mocks (~> 2.5.0)
+ rspec-core (2.5.1)
+ rspec-expectations (2.5.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.5.0)
+ tzinfo (0.3.24)
+ will_paginate (3.0.pre2)
PLATFORMS
ruby
DEPENDENCIES
bundler (~> 1.0.0)
+ database_cleaner (~> 0.6.0)
jeweler (~> 1.5.2)
- rcov
- shoulda
+ mongoid (= 2.0.0.rc.7)
+ rspec (~> 2.5.0)
View
@@ -8,6 +8,7 @@ rescue Bundler::BundlerError => e
exit e.status_code
end
require 'rake'
+require 'rspec/core/rake_task'
require 'jeweler'
Jeweler::Tasks.new do |gem|
@@ -26,28 +27,10 @@ Jeweler::Tasks.new do |gem|
end
Jeweler::RubygemsDotOrgTasks.new
-require 'rake/testtask'
-Rake::TestTask.new(:test) do |test|
- test.libs << 'lib' << 'test'
- test.pattern = 'test/**/test_*.rb'
- test.verbose = true
-end
-require 'rcov/rcovtask'
-Rcov::RcovTask.new do |test|
- test.libs << 'test'
- test.pattern = 'test/**/test_*.rb'
- test.verbose = true
+desc "Run all tests"
+RSpec::Core::RakeTask.new(:spec) do |spec|
+ spec.pattern = "spec/**/*_spec.rb"
end
-task :default => :test
-
-require 'rake/rdoctask'
-Rake::RDocTask.new do |rdoc|
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
-
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = "mongoid_fulltext #{version}"
- rdoc.rdoc_files.include('README*')
- rdoc.rdoc_files.include('lib/**/*.rb')
-end
+task :default => :spec
View
@@ -0,0 +1,7 @@
+class Artist
+ include Mongoid::Document
+ include Mongoid::FullTextSearch
+
+ field :title
+
+end
View
@@ -0,0 +1,7 @@
+class Artwork
+ include Mongoid::Document
+ include Mongoid::FullTextSearch
+
+ field :title
+
+end
@@ -0,0 +1,7 @@
+require 'spec_helper'
+
+module Mongoid
+ describe FullTextSearch do
+
+ end
+end
View
@@ -0,0 +1,20 @@
+require 'rubygems'
+require 'bundler/setup'
+require 'rspec'
+
+require 'mongoid'
+require 'database_cleaner'
+
+Mongoid.configure do |config|
+ name = "mongoid_fulltext_test"
+ config.master = Mongo::Connection.new.db(name)
+end
+
+require File.expand_path("../../lib/mongoid_fulltext", __FILE__)
+Dir["#{File.dirname(__FILE__)}/models/*.rb"].each { |f| require f }
+
+Rspec.configure do |c|
+ c.before(:all) { DatabaseCleaner.strategy = :truncation }
+ c.before(:each) { DatabaseCleaner.clean }
+end
+
View
@@ -1,18 +0,0 @@
-require 'rubygems'
-require 'bundler'
-begin
- Bundler.setup(:default, :development)
-rescue Bundler::BundlerError => e
- $stderr.puts e.message
- $stderr.puts "Run `bundle install` to install missing gems"
- exit e.status_code
-end
-require 'test/unit'
-require 'shoulda'
-
-$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
-$LOAD_PATH.unshift(File.dirname(__FILE__))
-require 'mongoid_fulltext'
-
-class Test::Unit::TestCase
-end
@@ -1,7 +0,0 @@
-require 'helper'
-
-class TestMongoidFulltext < Test::Unit::TestCase
- should "probably rename this file and start testing for real" do
- flunk "hey buddy, you should probably rename this file and start testing for real"
- end
-end

0 comments on commit 5a49080

Please sign in to comment.