Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

cleanup test process to no longer use appraisals

- removed appraisals
- run tests for both ActiveRecord & Mongoid when calling `rake`
- add tests on jruby again
  • Loading branch information...
commit 766636cb7f33f06cd5510af7c9ab10885ec21d00 1 parent 5bdf9a0
@lwe authored
View
7 .travis.yml
@@ -1,10 +1,5 @@
language: ruby
-env:
- - ORM=active_record
- - ORM=mongoid
rvm:
- 1.8.7
- 1.9.3
-#gemfile:
-# - gemfiles/rails-3.0.gemfile
-# - gemfiles/rails-3.2.gemfile
+ - jruby-19mode
View
14 Appraisals
@@ -1,14 +0,0 @@
-appraise "rails-3.0" do
- gem 'activesupport', '~> 3.0.9'
- gem 'activerecord', '~> 3.0.9'
-end
-
-appraise "rails-3.1" do
- gem 'activesupport', '~> 3.1.0'
- gem 'activerecord', '~> 3.1.0'
-end
-
-appraise "rails-3.2" do
- gem 'activesupport', '~> 3.2.0'
- gem 'activerecord', '~> 3.2.0'
-end
View
2  Gemfile
@@ -3,7 +3,7 @@ source "http://rubygems.org"
gemspec
# some development deps
-gem 'jdbc-sqlite3', :platform => :jruby
+gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
gem 'sqlite3', :platform => :ruby
gem 'bson_ext', :platform => :ruby
View
7 Gemfile.lock
@@ -18,9 +18,6 @@ GEM
activesupport (3.2.0)
i18n (~> 0.6)
multi_json (~> 1.0)
- appraisal (0.4.0)
- bundler
- rake
arel (3.0.0)
bson (1.5.2)
bson (1.5.2-java)
@@ -28,7 +25,6 @@ GEM
bson (= 1.5.2)
builder (3.0.0)
i18n (0.6.0)
- jdbc-sqlite3 (3.7.2)
minitest (2.10.1)
mongo (1.5.2)
bson (= 1.5.2)
@@ -47,9 +43,8 @@ PLATFORMS
DEPENDENCIES
activerecord (>= 3.0.0)
- appraisal (>= 0.4)
+ activerecord-jdbcsqlite3-adapter
bson_ext
- jdbc-sqlite3
minitest (>= 2.3.0)
mongoid (~> 2.0)
rake (>= 0.9.2)
View
30 Rakefile
@@ -1,18 +1,30 @@
require 'rubygems'
require 'bundler/setup'
-require 'appraisal'
require 'rake/testtask'
-include Rake::DSL
-
Bundler::GemHelper.install_tasks
-desc 'Default: run unit tests.'
+desc 'Default: run all unit tests for both ActiveRecord & Mongoid.'
task :default => :test
-desc 'Run unit tests, use ORM=...'
-Rake::TestTask.new(:test) do |t|
- t.libs << 'test'
- t.test_files = Dir.glob('test/**/*_test.rb')
- t.verbose = true
+namespace :test do
+ Rake::TestTask.new(:units) do |t|
+ t.libs << "test"
+ t.test_files = 'test/*_test.rb'
+ t.verbose = true
+ end
+
+ desc 'Run all unit tests for ActiveRecord'
+ task :activerecord do |t|
+ ENV['SIMPLE_ENUM_TEST_ORM'] = 'active_record'
+ Rake::Task['test:units'].execute
+ end
+
+ desc 'Run all unit tests for Mongoid'
+ task :mongoid do |t|
+ ENV['SIMPLE_ENUM_TEST_ORM'] = 'mongoid'
+ Rake::Task['test:units'].execute
+ end
end
+
+task :test => [:'test:activerecord', :'test:mongoid']
View
11 gemfiles/rails-3.0.gemfile
@@ -1,11 +0,0 @@
-# This file was generated by Appraisal
-
-source "http://rubygems.org"
-
-gem "jdbc-sqlite3", :platform=>:jruby
-gem "sqlite3", :platform=>:ruby
-gem "bson_ext", :platform=>:ruby
-gem "activesupport", "~> 3.0.9"
-gem "activerecord", "~> 3.0.9"
-
-gemspec :path=>"../"
View
53 gemfiles/rails-3.0.gemfile.lock
@@ -1,53 +0,0 @@
-PATH
- remote: /Users/lukas/Projects/_github/simple_enum
- specs:
- simple_enum (1.6.1)
- activesupport (>= 3.0.0)
-
-GEM
- remote: http://rubygems.org/
- specs:
- activemodel (3.0.15)
- activesupport (= 3.0.15)
- builder (~> 2.1.2)
- i18n (~> 0.5.0)
- activerecord (3.0.15)
- activemodel (= 3.0.15)
- activesupport (= 3.0.15)
- arel (~> 2.0.10)
- tzinfo (~> 0.3.23)
- activesupport (3.0.15)
- appraisal (0.4.1)
- bundler
- rake
- arel (2.0.10)
- bson (1.6.4)
- bson_ext (1.6.4)
- bson (~> 1.6.4)
- builder (2.1.2)
- i18n (0.5.0)
- minitest (3.2.0)
- mongo (1.6.4)
- bson (~> 1.6.4)
- mongoid (2.2.6)
- activemodel (~> 3.0.0)
- mongo (~> 1.3)
- tzinfo (~> 0.3.22)
- rake (0.9.2.2)
- sqlite3 (1.3.6)
- tzinfo (0.3.33)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- activerecord (~> 3.0.9)
- activesupport (~> 3.0.9)
- appraisal (>= 0.4)
- bson_ext
- jdbc-sqlite3
- minitest (>= 2.3.0)
- mongoid (~> 2.0)
- rake (>= 0.9.2)
- simple_enum!
- sqlite3
View
11 gemfiles/rails-3.1.gemfile
@@ -1,11 +0,0 @@
-# This file was generated by Appraisal
-
-source "http://rubygems.org"
-
-gem "jdbc-sqlite3", :platform=>:jruby
-gem "sqlite3", :platform=>:ruby
-gem "bson_ext", :platform=>:ruby
-gem "activesupport", "~> 3.1.0"
-gem "activerecord", "~> 3.1.0"
-
-gemspec :path=>"../"
View
55 gemfiles/rails-3.1.gemfile.lock
@@ -1,55 +0,0 @@
-PATH
- remote: /Users/lukas/Projects/_github/simple_enum
- specs:
- simple_enum (1.6.1)
- activesupport (>= 3.0.0)
-
-GEM
- remote: http://rubygems.org/
- specs:
- activemodel (3.1.6)
- activesupport (= 3.1.6)
- builder (~> 3.0.0)
- i18n (~> 0.6)
- activerecord (3.1.6)
- activemodel (= 3.1.6)
- activesupport (= 3.1.6)
- arel (~> 2.2.3)
- tzinfo (~> 0.3.29)
- activesupport (3.1.6)
- multi_json (>= 1.0, < 1.3)
- appraisal (0.4.1)
- bundler
- rake
- arel (2.2.3)
- bson (1.6.4)
- bson_ext (1.6.4)
- bson (~> 1.6.4)
- builder (3.0.0)
- i18n (0.6.0)
- minitest (3.2.0)
- mongo (1.6.2)
- bson (~> 1.6.2)
- mongoid (2.4.11)
- activemodel (~> 3.1)
- mongo (<= 1.6.2)
- tzinfo (~> 0.3.22)
- multi_json (1.2.0)
- rake (0.9.2.2)
- sqlite3 (1.3.6)
- tzinfo (0.3.33)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- activerecord (~> 3.1.0)
- activesupport (~> 3.1.0)
- appraisal (>= 0.4)
- bson_ext
- jdbc-sqlite3
- minitest (>= 2.3.0)
- mongoid (~> 2.0)
- rake (>= 0.9.2)
- simple_enum!
- sqlite3
View
11 gemfiles/rails-3.2.gemfile
@@ -1,11 +0,0 @@
-# This file was generated by Appraisal
-
-source "http://rubygems.org"
-
-gem "jdbc-sqlite3", :platform=>:jruby
-gem "sqlite3", :platform=>:ruby
-gem "bson_ext", :platform=>:ruby
-gem "activesupport", "~> 3.2.0"
-gem "activerecord", "~> 3.2.0"
-
-gemspec :path=>"../"
View
55 gemfiles/rails-3.2.gemfile.lock
@@ -1,55 +0,0 @@
-PATH
- remote: /Users/lukas/Projects/_github/simple_enum
- specs:
- simple_enum (1.6.1)
- activesupport (>= 3.0.0)
-
-GEM
- remote: http://rubygems.org/
- specs:
- activemodel (3.2.6)
- activesupport (= 3.2.6)
- builder (~> 3.0.0)
- activerecord (3.2.6)
- activemodel (= 3.2.6)
- activesupport (= 3.2.6)
- arel (~> 3.0.2)
- tzinfo (~> 0.3.29)
- activesupport (3.2.6)
- i18n (~> 0.6)
- multi_json (~> 1.0)
- appraisal (0.4.1)
- bundler
- rake
- arel (3.0.2)
- bson (1.6.4)
- bson_ext (1.6.4)
- bson (~> 1.6.4)
- builder (3.0.0)
- i18n (0.6.0)
- minitest (3.2.0)
- mongo (1.6.2)
- bson (~> 1.6.2)
- mongoid (2.4.11)
- activemodel (~> 3.1)
- mongo (<= 1.6.2)
- tzinfo (~> 0.3.22)
- multi_json (1.3.6)
- rake (0.9.2.2)
- sqlite3 (1.3.6)
- tzinfo (0.3.33)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- activerecord (~> 3.2.0)
- activesupport (~> 3.2.0)
- appraisal (>= 0.4)
- bson_ext
- jdbc-sqlite3
- minitest (>= 2.3.0)
- mongoid (~> 2.0)
- rake (>= 0.9.2)
- simple_enum!
- sqlite3
View
11 simple_enum.gemspec
@@ -23,16 +23,9 @@ Gem::Specification.new do |s|
s.license = 'MIT'
s.add_dependency "activesupport", '>= 3.0.0'
-
+
s.add_development_dependency 'rake', '>= 0.9.2'
- s.add_development_dependency 'appraisal', '>= 0.4'
s.add_development_dependency 'minitest', '>= 2.3.0'
s.add_development_dependency 'activerecord', '>= 3.0.0'
s.add_development_dependency 'mongoid', '~> 2.0'
-
- unless RUBY_PLATFORM =~ /java/
- s.add_development_dependency 'sqlite3'
- else
- s.add_development_dependency 'activerecord-jdbcsqlite3-adapter'
- end
-end
+end
View
18 test/test_helper.rb
@@ -1,15 +1,13 @@
# Setup environment for both tests and IRB interactive console
#
-
$KCODE = 'u' unless RUBY_VERSION =~ /^1\.9/ # to make parameterize work...
require 'rubygems'
require 'bundler/setup'
-require 'test/unit'
+require 'minitest/autorun'
require 'active_support'
require 'active_support/version'
-require 'minitest/autorun'
# setup fake rails env
ROOT = File.join(File.dirname(__FILE__), '..')
@@ -17,7 +15,7 @@
RAILS_ENV = 'test'
# load orms
-ORM = ENV['ORM'] || 'active_record'
+ORM = ENV['SIMPLE_ENUM_TEST_ORM'] || 'active_record'
def mongoid?; return ORM == 'mongoid';end
def activerecord?; return ORM == 'active_record';end
@@ -25,14 +23,14 @@ def activerecord?; return ORM == 'active_record';end
# load database implemntation
require ORM
-# load simple enum
+# load simple enum AFTER ORM
require 'simple_enum'
# load ORM specific stuff
require 'orm/common'
require "orm/#{ORM}"
-# Add test locales
+# Add locales
I18n.load_path << File.join(File.dirname(__FILE__), 'locales.yml')
# setup db
@@ -40,11 +38,3 @@ def activerecord?; return ORM == 'active_record';end
# Test environment info
puts "Testing against: activesupport-#{ActiveSupport::VERSION::STRING}, #{ORM.to_s}-#{orm_version}"
-
-# do some magic to initialze DB for IRB session
-if Object.const_defined?('IRB')
- reload_db :fill => true, :genders => true
-else # and load test classes when in test cases...
- require 'test/unit'
- require 'active_support/test_case'
-end
Please sign in to comment.
Something went wrong with that request. Please try again.