Browse files

(yet again) enable running Rails's AR tests (for now works with 3-2-s…

…table)
  • Loading branch information...
1 parent 52dc5ce commit 79b7ca72f86a3ef234288e749f402fa7f4c85d26 @kares kares committed Apr 4, 2013
View
4 Gemfile
@@ -1,4 +1,4 @@
-source "http://rubygems.org"
+source "https://rubygems.org"
gem 'activerecord'
gem 'jruby-openssl', :platform => :jruby
@@ -12,7 +12,7 @@ gem 'rake', :require => nil
# appraisal ignores group block declarations :
gem 'test-unit', '2.5.4', :group => :test
gem 'test-unit-context', :group => :test
-gem 'mocha', '~> 0.12.10', :require => nil, :group => :test # '>= 0.13.0'
+gem 'mocha', '>= 0.13.0', :require => nil, :group => :test
gem 'simplecov', :require => nil, :group => :test
gem 'bcrypt-ruby', '~> 3.0.0', :require => nil, :group => :test
View
40 Gemfile.lock
@@ -1,32 +1,31 @@
GEM
- remote: http://rubygems.org/
+ remote: https://rubygems.org/
specs:
- actionpack (3.2.11)
- activemodel (= 3.2.11)
- activesupport (= 3.2.11)
+ actionpack (3.2.13)
+ activemodel (= 3.2.13)
+ activesupport (= 3.2.13)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
- rack (~> 1.4.0)
+ rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
- activemodel (3.2.11)
- activesupport (= 3.2.11)
+ activemodel (3.2.13)
+ activesupport (= 3.2.13)
builder (~> 3.0.0)
- activerecord (3.2.11)
- activemodel (= 3.2.11)
- activesupport (= 3.2.11)
+ activerecord (3.2.13)
+ activemodel (= 3.2.13)
+ activesupport (= 3.2.13)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
- activesupport (3.2.11)
- i18n (~> 0.6)
+ activesupport (3.2.13)
+ i18n (= 0.6.1)
multi_json (~> 1.0)
appraisal (0.5.1)
bundler
rake
arel (3.0.2)
- bcrypt-ruby (3.0.1)
bcrypt-ruby (3.0.1-java)
bouncy-castle-java (1.5.0146.1)
builder (3.0.4)
@@ -37,12 +36,11 @@ GEM
journey (1.0.4)
jruby-openssl (0.8.2)
bouncy-castle-java (>= 1.5.0146.1)
- linecache (0.46-java)
metaclass (0.0.1)
- mocha (0.12.10)
+ mocha (0.13.3)
metaclass (~> 0.0.1)
- multi_json (1.5.0)
- rack (1.4.4)
+ multi_json (1.7.2)
+ rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-test (0.6.2)
@@ -51,8 +49,6 @@ GEM
ruby-debug (0.10.4)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.4.0)
- ruby-debug-base (0.10.4)
- linecache (>= 0.3)
ruby-debug-base (0.10.4-java)
simplecov (0.7.1)
multi_json (~> 1.0)
@@ -66,8 +62,8 @@ GEM
test-unit (2.5.4)
test-unit-context (0.3.0)
test-unit (>= 2.4.0)
- tilt (1.3.3)
- tzinfo (0.3.35)
+ tilt (1.3.6)
+ tzinfo (0.3.37)
PLATFORMS
java
@@ -79,7 +75,7 @@ DEPENDENCIES
bcrypt-ruby (~> 3.0.0)
erubis
jruby-openssl
- mocha (~> 0.12.10)
+ mocha (>= 0.13.0)
rake
ruby-debug
simplecov
View
4 gemfiles/rails23.gemfile
@@ -1,13 +1,13 @@
# This file was generated by Appraisal
-source "http://rubygems.org"
+source "https://rubygems.org"
gem "jruby-openssl", :platform=>:jruby
gem "appraisal"
gem "rake", :require=>nil
gem "test-unit", "2.5.4", :group=>:test
gem "test-unit-context", :group=>:test
-gem "mocha", "~> 0.12.10", :require=>nil, :group=>:test
+gem "mocha", ">= 0.13.0", :require=>nil, :group=>:test
gem "simplecov", :require=>nil, :group=>:test
gem "bcrypt-ruby", "~> 3.0.0", :require=>nil, :group=>:test
gem "activerecord", "~> 2.3.18"
View
7 gemfiles/rails23.gemfile.lock
@@ -1,5 +1,5 @@
GEM
- remote: http://rubygems.org/
+ remote: https://rubygems.org/
specs:
actionmailer (2.3.18)
actionpack (= 2.3.18)
@@ -14,13 +14,12 @@ GEM
appraisal (0.5.1)
bundler
rake
- bcrypt-ruby (3.0.1)
bcrypt-ruby (3.0.1-java)
bouncy-castle-java (1.5.0147)
jruby-openssl (0.8.4)
bouncy-castle-java (>= 1.5.0147)
metaclass (0.0.1)
- mocha (0.12.10)
+ mocha (0.13.3)
metaclass (~> 0.0.1)
multi_json (1.5.0)
rack (1.1.6)
@@ -48,7 +47,7 @@ DEPENDENCIES
appraisal
bcrypt-ruby (~> 3.0.0)
jruby-openssl
- mocha (~> 0.12.10)
+ mocha (>= 0.13.0)
rails (~> 2.3.18)
rake
simplecov
View
4 gemfiles/rails30.gemfile
@@ -1,13 +1,13 @@
# This file was generated by Appraisal
-source "http://rubygems.org"
+source "https://rubygems.org"
gem "jruby-openssl", :platform=>:jruby
gem "appraisal"
gem "rake", :require=>nil
gem "test-unit", "2.5.4", :group=>:test
gem "test-unit-context", :group=>:test
-gem "mocha", "~> 0.12.10", :require=>nil, :group=>:test
+gem "mocha", ">= 0.13.0", :require=>nil, :group=>:test
gem "simplecov", :require=>nil, :group=>:test
gem "bcrypt-ruby", "~> 3.0.0", :require=>nil, :group=>:test
gem "activerecord", "~> 3.0.20"
View
6 gemfiles/rails30.gemfile.lock
@@ -1,5 +1,5 @@
GEM
- remote: http://rubygems.org/
+ remote: https://rubygems.org/
specs:
activemodel (3.0.20)
activesupport (= 3.0.20)
@@ -22,7 +22,7 @@ GEM
jruby-openssl (0.8.4)
bouncy-castle-java (>= 1.5.0147)
metaclass (0.0.1)
- mocha (0.12.10)
+ mocha (0.13.3)
metaclass (~> 0.0.1)
multi_json (1.5.0)
rake (10.0.3)
@@ -43,7 +43,7 @@ DEPENDENCIES
appraisal
bcrypt-ruby (~> 3.0.0)
jruby-openssl
- mocha (~> 0.12.10)
+ mocha (>= 0.13.0)
rake
simplecov
test-unit (= 2.5.4)
View
4 gemfiles/rails31.gemfile
@@ -1,13 +1,13 @@
# This file was generated by Appraisal
-source "http://rubygems.org"
+source "https://rubygems.org"
gem "jruby-openssl", :platform=>:jruby
gem "appraisal"
gem "rake", :require=>nil
gem "test-unit", "2.5.4", :group=>:test
gem "test-unit-context", :group=>:test
-gem "mocha", "~> 0.12.10", :require=>nil, :group=>:test
+gem "mocha", ">= 0.13.0", :require=>nil, :group=>:test
gem "simplecov", :require=>nil, :group=>:test
gem "bcrypt-ruby", "~> 3.0.0", :require=>nil, :group=>:test
gem "activerecord", "~> 3.1.12"
View
7 gemfiles/rails31.gemfile.lock
@@ -1,5 +1,5 @@
GEM
- remote: http://rubygems.org/
+ remote: https://rubygems.org/
specs:
activemodel (3.1.12)
activesupport (= 3.1.12)
@@ -16,15 +16,14 @@ GEM
bundler
rake
arel (2.2.3)
- bcrypt-ruby (3.0.1)
bcrypt-ruby (3.0.1-java)
bouncy-castle-java (1.5.0147)
builder (3.0.4)
i18n (0.6.4)
jruby-openssl (0.8.4)
bouncy-castle-java (>= 1.5.0147)
metaclass (0.0.1)
- mocha (0.12.10)
+ mocha (0.13.3)
metaclass (~> 0.0.1)
multi_json (1.2.0)
rake (10.0.3)
@@ -45,7 +44,7 @@ DEPENDENCIES
appraisal
bcrypt-ruby (~> 3.0.0)
jruby-openssl
- mocha (~> 0.12.10)
+ mocha (>= 0.13.0)
rake
simplecov
test-unit (= 2.5.4)
View
4 gemfiles/rails32.gemfile
@@ -1,13 +1,13 @@
# This file was generated by Appraisal
-source "http://rubygems.org"
+source "https://rubygems.org"
gem "jruby-openssl", :platform=>:jruby
gem "appraisal"
gem "rake", :require=>nil
gem "test-unit", "2.5.4", :group=>:test
gem "test-unit-context", :group=>:test
-gem "mocha", "~> 0.12.10", :require=>nil, :group=>:test
+gem "mocha", ">= 0.13.0", :require=>nil, :group=>:test
gem "simplecov", :require=>nil, :group=>:test
gem "bcrypt-ruby", "~> 3.0.0", :require=>nil, :group=>:test
gem "activerecord", "~> 3.2.13"
View
7 gemfiles/rails32.gemfile.lock
@@ -1,5 +1,5 @@
GEM
- remote: http://rubygems.org/
+ remote: https://rubygems.org/
specs:
activemodel (3.2.13)
activesupport (= 3.2.13)
@@ -16,15 +16,14 @@ GEM
bundler
rake
arel (3.0.2)
- bcrypt-ruby (3.0.1)
bcrypt-ruby (3.0.1-java)
bouncy-castle-java (1.5.0147)
builder (3.0.4)
i18n (0.6.1)
jruby-openssl (0.8.4)
bouncy-castle-java (>= 1.5.0147)
metaclass (0.0.1)
- mocha (0.12.10)
+ mocha (0.13.3)
metaclass (~> 0.0.1)
multi_json (1.5.0)
rake (10.0.3)
@@ -45,7 +44,7 @@ DEPENDENCIES
appraisal
bcrypt-ruby (~> 3.0.0)
jruby-openssl
- mocha (~> 0.12.10)
+ mocha (>= 0.13.0)
rake
simplecov
test-unit (= 2.5.4)
View
4 gemfiles/rails40.gemfile
@@ -1,14 +1,14 @@
# This file was generated by Appraisal
-source "http://rubygems.org"
+source "https://rubygems.org"
gem "activerecord"
gem "jruby-openssl", :platform=>:jruby
gem "appraisal"
gem "rake", :require=>nil
gem "test-unit", "2.5.4", :group=>:test
gem "test-unit-context", :group=>:test
-gem "mocha", "~> 0.12.10", :require=>nil, :group=>:test
+gem "mocha", ">= 0.13.0", :require=>nil, :group=>:test
gem "simplecov", :require=>nil, :group=>:test
gem "bcrypt-ruby", "~> 3.0.0", :require=>nil, :group=>:test
gem "rails", :github=>"rails/rails"
View
6 gemfiles/rails40.gemfile.lock
@@ -53,7 +53,7 @@ GIT
thor (>= 0.17.0, < 2.0)
GEM
- remote: http://rubygems.org/
+ remote: https://rubygems.org/
specs:
appraisal (0.5.1)
bundler
@@ -76,7 +76,7 @@ GEM
metaclass (0.0.1)
mime-types (1.21)
minitest (4.7.0)
- mocha (0.12.10)
+ mocha (0.13.3)
metaclass (~> 0.0.1)
multi_json (1.7.1)
polyglot (0.3.3)
@@ -121,7 +121,7 @@ DEPENDENCIES
bcrypt-ruby (~> 3.0.0)
journey!
jruby-openssl
- mocha (~> 0.12.10)
+ mocha (>= 0.13.0)
rails!
rake
simplecov
View
73 rakelib/rails.rake
@@ -1,39 +1,13 @@
namespace :rails do
- def _adapter(n)
- case n
- when /postgres/
- 'postgresql'
- else
- n
- end
- end
-
- def _driver(n)
- case n
- when /postgres/
- 'postgres'
- else
- n
- end
- end
-
- def _target(n)
- case n
- when /postgres/
- 'test_jdbcpostgresql'
- else
- "test_jdbc#{n}"
- end
- end
-
- task :test => :jar do
- raise "need a DRIVER" unless driver = ENV['DRIVER']
- raise "need location of RAILS source code" unless rails_dir = ENV['RAILS']
+
+ task :test do
+ raise "need a DRIVER e.g. DRIVER=mysql" unless driver = ENV['DRIVER'] || ENV['ADAPTER']
+ raise "need location of RAILS source code e.g. RAILS=../rails" unless rails_dir = ENV['RAILS']
rails_dir = File.join(rails_dir, '..') if rails_dir =~ /activerecord$/
activerecord_dir = File.join(rails_dir, 'activerecord') # rails/activerecord
ar_jdbc_dir = File.expand_path('..', File.dirname(__FILE__))
-
+
rubylib = [
"#{ar_jdbc_dir}/lib",
"#{ar_jdbc_dir}/jdbc-#{_driver(driver)}/lib",
@@ -46,4 +20,41 @@ namespace :rails do
Dir.chdir(activerecord_dir) { rake "RUBYLIB=#{rubylib.join(':')}", "#{_target(driver)}" }
end
+
+ %w(MySQL SQLite3 Postgres).each do |adapter|
+ desc "Run Rails' ActiveRecord tests with #{adapter} (JDBC)"
+ task "test_#{adapter.downcase}" do
+ ENV['ADAPTER'] = adapter; Rake::Task['rails:test'].invoke
+ end
+ end
+
+ private
+
+ def _adapter(name)
+ case name
+ when /postgres/i
+ 'postgresql'
+ else
+ name.downcase
+ end
+ end
+
+ def _driver(name)
+ case name
+ when /postgres/i
+ 'postgres'
+ else
+ name.downcase
+ end
+ end
+
+ def _target(name)
+ case name
+ when /postgres/i
+ 'test_jdbcpostgresql'
+ else
+ "test_jdbc#{name.downcase}"
+ end
+ end
+
end

0 comments on commit 79b7ca7

Please sign in to comment.