Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added several gemfiles to test against multiple versions of activerecord

Updated test environment to use bundler
Updated README
  • Loading branch information...
commit 3230fe1b7c5281644b2d229dbb6a2c4498bf7ab3 1 parent 864acf1
Stefan Henzen authored
View
4 Gemfile
@@ -1,9 +1,9 @@
source 'http://rubygems.org'
-gemspec
+gem 'activerecord', '~> 3.2.13'
group :development, :test do
- gem 'debugger' if RUBY_VERSION =~ /\A1.9/
+ gem 'debugger'
end
group :development do
View
17 Gemfile.rails-3-0
@@ -0,0 +1,17 @@
+source 'http://rubygems.org'
+
+gem 'activerecord', '~> 3.0.20'
+
+group :development, :test do
+ gem 'debugger'
+end
+
+group :development do
+ gem 'rdoc'
+end
+
+group :test do
+ gem 'sqlite3'
+ gem 'pg'
+ gem 'mysql'
+end
View
41 Gemfile.rails-3-0.lock
@@ -0,0 +1,41 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ activemodel (3.0.20)
+ activesupport (= 3.0.20)
+ builder (~> 2.1.2)
+ i18n (~> 0.5.0)
+ activerecord (3.0.20)
+ activemodel (= 3.0.20)
+ activesupport (= 3.0.20)
+ arel (~> 2.0.10)
+ tzinfo (~> 0.3.23)
+ activesupport (3.0.20)
+ arel (2.0.10)
+ builder (2.1.2)
+ columnize (0.3.6)
+ debugger (1.5.0)
+ columnize (>= 0.3.1)
+ debugger-linecache (~> 1.2.0)
+ debugger-ruby_core_source (~> 1.2.0)
+ debugger-linecache (1.2.0)
+ debugger-ruby_core_source (1.2.0)
+ i18n (0.5.0)
+ json (1.7.7)
+ mysql (2.9.1)
+ pg (0.15.0)
+ rdoc (4.0.1)
+ json (~> 1.4)
+ sqlite3 (1.3.7)
+ tzinfo (0.3.37)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ activerecord (~> 3.0.20)
+ debugger
+ mysql
+ pg
+ rdoc
+ sqlite3
View
17 Gemfile.rails-3-1
@@ -0,0 +1,17 @@
+source 'http://rubygems.org'
+
+gem 'activerecord', '~> 3.1.12'
+
+group :development, :test do
+ gem 'debugger'
+end
+
+group :development do
+ gem 'rdoc'
+end
+
+group :test do
+ gem 'sqlite3'
+ gem 'pg'
+ gem 'mysql'
+end
View
43 Gemfile.rails-3-1.lock
@@ -0,0 +1,43 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ activemodel (3.1.12)
+ activesupport (= 3.1.12)
+ builder (~> 3.0.0)
+ i18n (~> 0.6)
+ activerecord (3.1.12)
+ activemodel (= 3.1.12)
+ activesupport (= 3.1.12)
+ arel (~> 2.2.3)
+ tzinfo (~> 0.3.29)
+ activesupport (3.1.12)
+ multi_json (~> 1.0)
+ arel (2.2.3)
+ builder (3.0.4)
+ columnize (0.3.6)
+ debugger (1.5.0)
+ columnize (>= 0.3.1)
+ debugger-linecache (~> 1.2.0)
+ debugger-ruby_core_source (~> 1.2.0)
+ debugger-linecache (1.2.0)
+ debugger-ruby_core_source (1.2.0)
+ i18n (0.6.4)
+ json (1.7.7)
+ multi_json (1.7.2)
+ mysql (2.9.1)
+ pg (0.15.0)
+ rdoc (4.0.1)
+ json (~> 1.4)
+ sqlite3 (1.3.7)
+ tzinfo (0.3.37)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ activerecord (~> 3.1.12)
+ debugger
+ mysql
+ pg
+ rdoc
+ sqlite3
View
13 README.rdoc
@@ -225,7 +225,18 @@ Additionally, if you think something is wrong with your depth cache:
= Tests
-The Ancestry gem comes with a unit test suite consisting of about 1800 assertions in about 30 tests. It takes about 10 seconds to run on sqlite. To run it yourself check out the repository from GitHub, copy test/database.example.yml to test/database.yml and type 'rake'. You can pass rake style options for ActiveRecord version to test against (e.g. ar=3.0.1) and database to test against (e.g. db=mysql). The test suite is located in test/has_ancestry_test.rb.
+The Ancestry gem comes with a unit test suite consisting of about 1800 assertions in about 30 tests. It takes about 10 seconds to run on sqlite. To run it yourself:
+- check out the repository from GitHub
+- copy test/database.example.yml to test/database.yml
+- run <tt>bundle</tt>
+- run <tt>rake [test]</tt>
+
+You can pass rake style options for database to test against (e.g. db=mysql). By default, the test suite runs against the latest activerecord version. You can run agains activerecord 3-0 or 3-1 as follows:
+- run <tt>bundle --gemfile Gemfile.rails-<version></tt>
+- run <tt>rake [test] BUNDLE_GEMFILE=Gemfile.rails-<version></tt>
+
+To run the test suite multiple times against several databases and all supported activerecord versions, run <tt>rake test_all</tt>
+The test suite is located in test/has_ancestry_test.rb.
= Internals
View
4 Rakefile
@@ -16,9 +16,9 @@ end
desc 'Test the ancestry plugin with multiple databases and activerecord versions.'
task :test_all do |t|
commands = []
- %w(3.0.0 3.1.0 3.2.0).each do |activerecord_version|
+ %w(Gemfile.rails-3-0 Gemfile.rails-3-1 Gemfile).each do |gemfile|
%w(sqlite3 postgresql mysql).each do |database_adapter|
- commands << "rake test ar=#{activerecord_version} db=#{database_adapter}"
+ commands << "rake test db=#{database_adapter} BUNDLE_GEMFILE=#{gemfile}"
end
end
View
9 test/environment.rb
@@ -1,10 +1,5 @@
require 'rubygems'
-
-if ENV['ar'].nil?
- gem 'activerecord'
-else
- gem 'activerecord', ENV['ar']
-end
+require 'bundler/setup'
require 'active_record'
require 'active_support/test_case'
@@ -19,7 +14,7 @@
class AncestryTestDatabase
def self.setup
ActiveRecord::Base.logger = ActiveSupport::BufferedLogger.new('log/test.log')
- ActiveRecord::Base.establish_connection YAML.load(File.open(File.join(File.dirname(__FILE__), 'database.yml')).read)[ENV['db'] || 'sqlite3']
+ ActiveRecord::Base.establish_connection YAML.load(File.open(File.expand_path('../database.yml', __FILE__)).read)[ENV['db'] || 'sqlite3']
end
def self.with_model options = {}

0 comments on commit 3230fe1

Please sign in to comment.
Something went wrong with that request. Please try again.