Skip to content

Commit

Permalink
Made it so rake test will actually run tests against AS2 and AS3 and …
Browse files Browse the repository at this point in the history
…the active model lint test.
  • Loading branch information
jnunemaker committed Jun 18, 2010
1 parent 2d8672d commit c7b9724
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 7 deletions.
34 changes: 29 additions & 5 deletions Rakefile
Expand Up @@ -3,11 +3,35 @@ require 'rake'
require 'rake/testtask'
require File.expand_path('../lib/mongo_mapper/version', __FILE__)

Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
test.ruby_opts << '-rubygems'
test.pattern = 'test/**/test_*.rb'
test.verbose = true
namespace :test do
Rake::TestTask.new(:all) do |test|
test.libs << 'lib' << 'test'
test.ruby_opts << '-rubygems'
test.pattern = 'test/{functional,unit}/**/test_*.rb'
test.verbose = true
end

desc "Run active model lint test"
task :am_lint do
sh 'ruby -Itest -rubygems test/test_active_model_lint.rb'
end

desc "Run tests against Active Support 2"
task :as2 do
sh 'ACTIVE_SUPPORT_VERSION="<= 2.3.8" rake test:all'
end

desc "Run tests against Active Support 3"
task :as3 do
sh 'ACTIVE_SUPPORT_VERSION=">= 3.0.0.beta3" rake test:all'
end
end

desc 'Runs all tests against ActiveSupport 2 and 3'
task :test do
Rake::Task['test:as2'].invoke
Rake::Task['test:as3'].invoke
Rake::Task['test:am_lint'].invoke
end

task :default => :test
Expand Down
2 changes: 1 addition & 1 deletion specs.watchr
Expand Up @@ -29,7 +29,7 @@ def run_test_file(file)
end

def run_all_tests
run "rake test"
run "rake test:all"
end

def related_test_files(path)
Expand Down
File renamed without changes.
8 changes: 7 additions & 1 deletion test/test_helper.rb
@@ -1,4 +1,8 @@
require File.expand_path(File.dirname(__FILE__) + '/../lib/mongo_mapper')
gem 'activesupport', ENV['ACTIVE_SUPPORT_VERSION']
require 'active_support/version'

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

gem 'jnunemaker-matchy', '0.4.0'
Expand Down Expand Up @@ -96,3 +100,5 @@ def drop_indexes(klass)
MongoMapper.connection = Mongo::Connection.new('127.0.0.1', 27017, :logger => logger)
MongoMapper.database = "mm-test-#{RUBY_VERSION.gsub('.', '-')}"
MongoMapper.database.collections.each { |c| c.drop_indexes }

puts "\n--- Active Support Version: #{ActiveSupport::VERSION::STRING} ---\n"

0 comments on commit c7b9724

Please sign in to comment.