Skip to content

Commit

Permalink
setting up spec boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
aaw committed Apr 1, 2011
1 parent a977e26 commit 5a49080
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 64 deletions.
22 changes: 11 additions & 11 deletions .gitignore
Expand Up @@ -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
5 changes: 3 additions & 2 deletions Gemfile
Expand Up @@ -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
34 changes: 30 additions & 4 deletions Gemfile.lock
@@ -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)
27 changes: 5 additions & 22 deletions Rakefile
Expand Up @@ -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|
Expand All @@ -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
7 changes: 7 additions & 0 deletions spec/models/artist.rb
@@ -0,0 +1,7 @@
class Artist
include Mongoid::Document
include Mongoid::FullTextSearch

field :title

end
7 changes: 7 additions & 0 deletions spec/models/artwork.rb
@@ -0,0 +1,7 @@
class Artwork
include Mongoid::Document
include Mongoid::FullTextSearch

field :title

end
7 changes: 7 additions & 0 deletions spec/mongoid/fulltext_spec.rb
@@ -0,0 +1,7 @@
require 'spec_helper'

module Mongoid
describe FullTextSearch do

end
end
20 changes: 20 additions & 0 deletions spec/spec_helper.rb
@@ -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

18 changes: 0 additions & 18 deletions test/helper.rb

This file was deleted.

7 changes: 0 additions & 7 deletions test/test_mongoid_fulltext.rb

This file was deleted.

0 comments on commit 5a49080

Please sign in to comment.