Permalink
Browse files

Big refactoring to enable testing of Mongoid

- It will be refined gradually.
- From now on we must check for the ORM/ODM at the beginning of each
ORM/ODM specific spec file.
- TODO: Simplify Dummy rails application.
  • Loading branch information...
alup committed Jun 27, 2012
1 parent f63c305 commit 98679dcc56c4911d3b212eb99b90aa9051f2cdf2
View
@@ -1,3 +1,6 @@
+# multiple gemfiles
+gemfiles/*.lock
+
# RVM / rbenv version files
.rvmrc
.rbenv-version
View
@@ -1,3 +1,4 @@
+script: "bundle exec rake spec"
language: ruby
rvm:
- 1.8.7
@@ -11,6 +12,9 @@ rvm:
- rbx-18mode
- rbx-19mode
- ree
+gemfile:
+ - gemfiles/mongoid2.gemfile
+ - Gemfile
notifications:
recipients:
- andreas@aloop.org
View
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- money-rails (0.3.1)
+ money-rails (0.4.0)
activesupport (~> 3.0)
money (~> 5.0.0)
railties (~> 3.0)
@@ -38,6 +38,7 @@ GEM
multi_json (~> 1.0)
arel (3.0.2)
builder (3.0.0)
+ database_cleaner (0.7.2)
diff-lcs (1.1.3)
erubis (2.7.0)
ffi (1.0.11)
@@ -125,6 +126,7 @@ PLATFORMS
DEPENDENCIES
activerecord-jdbc-adapter
activerecord-jdbcsqlite3-adapter
+ database_cleaner
guard-rspec (~> 1.1)
jruby-openssl
money-rails!
View
@@ -16,9 +16,34 @@ require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new
-task :default => :spec
+task :default => "spec:all"
task :test => :spec
+namespace :spec do
+ desc "Run Tests against mongoid"
+ task :mongoid2 do
+ sh "BUNDLE_GEMFILE='gemfiles/mongoid2.gemfile' bundle --quiet"
+ sh "BUNDLE_GEMFILE='gemfiles/mongoid2.gemfile' bundle exec rake -t spec"
+ end
+
+ desc "Run Tests against activerecord"
+ task :activerecord do
+ sh "bundle --quiet"
+ sh "bundle exec rake -t spec"
+ end
+
+ desc "Run Tests against all ORMs"
+ task :all do
+ # Mongoid 2
+ sh "BUNDLE_GEMFILE='gemfiles/mongoid2.gemfile' bundle --quiet"
+ sh "BUNDLE_GEMFILE='gemfiles/mongoid2.gemfile' bundle exec rake -t spec"
+
+ # ActiveRecord
+ sh "bundle --quiet"
+ sh "bundle exec rake -t spec"
+ end
+end
+
desc "Update AUTHORS file"
task :authors do
sh "git shortlog -s | awk '{ print $2 \" \" $3 }' > AUTHORS"
View
@@ -0,0 +1,16 @@
+source :rubygems
+
+gem 'mongoid', '~> 2.4.0'
+
+platforms :jruby do
+ gem "activerecord-jdbc-adapter"
+ gem "activerecord-jdbcsqlite3-adapter"
+ gem "jruby-openssl"
+end
+
+platforms :ruby do
+ gem "bson_ext"
+ gem "sqlite3"
+end
+
+gemspec :path => '../'
View
@@ -28,4 +28,5 @@ Gem::Specification.new do |s|
s.add_development_dependency "rspec", "~> 2.10"
s.add_development_dependency "rspec-rails", "~> 2.10"
s.add_development_dependency "guard-rspec", "~> 1.1"
+ s.add_development_dependency 'database_cleaner', ['>= 0']
end
Oops, something went wrong.

0 comments on commit 98679dc

Please sign in to comment.