Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save hannahwhy/255911 to your computer and use it in GitHub Desktop.

Select an option

Save hannahwhy/255911 to your computer and use it in GitHub Desktop.
From 93b1fdda55459dab8eb28441f1c2869df0cd9186 Mon Sep 17 00:00:00 2001
From: David Yip <[email protected]>
Date: Mon, 14 Dec 2009 02:36:55 -0600
Subject: [PATCH 1/2] Load 'active_record', not 'activerecord': silences deprecation warnings.
---
test/test_helper.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 5861942..203fac5 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -1,7 +1,7 @@
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
require 'test/unit'
require 'rubygems'
-require 'activerecord'
+require 'active_record'
begin
require 'sqlite3'
--
1.6.4.4
From 773ddc3a3f5d5dbe5b008bf7560297ab48912da2 Mon Sep 17 00:00:00 2001
From: David Yip <[email protected]>
Date: Mon, 14 Dec 2009 02:41:09 -0600
Subject: [PATCH 2/2] Ruby 1.9 compatibility fixes: fix load paths for Rake tasks and tests.
---
Rakefile | 2 ++
tasks/testing.rb | 3 +++
test/after_commit_test.rb | 2 +-
test/observer_test.rb | 2 +-
4 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/Rakefile b/Rakefile
index f12e0f6..2d88bc9 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,5 +1,7 @@
require 'rubygems'
+$LOAD_PATH.unshift(File.dirname(__FILE__))
+
require 'tasks/distribution'
require 'tasks/testing'
diff --git a/tasks/testing.rb b/tasks/testing.rb
index 7fc3193..b87759a 100644
--- a/tasks/testing.rb
+++ b/tasks/testing.rb
@@ -2,9 +2,12 @@ require 'rake/testtask'
desc 'Test the after_commit plugin.'
Rake::TestTask.new(:test) do |t|
+ test_dir = File.expand_path(File.join(File.dirname(__FILE__), %w(.. test)))
+
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
+ t.ruby_opts = ["-I#{test_dir}"]
end
task :test => :check_dependencies
diff --git a/test/after_commit_test.rb b/test/after_commit_test.rb
index 6a7fa00..cc625db 100644
--- a/test/after_commit_test.rb
+++ b/test/after_commit_test.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/test_helper'
+require 'test_helper'
class MockRecord < ActiveRecord::Base
attr_accessor :before_commit_on_create_called
diff --git a/test/observer_test.rb b/test/observer_test.rb
index 67af200..f991ae7 100644
--- a/test/observer_test.rb
+++ b/test/observer_test.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/test_helper'
+require 'test_helper'
class ObservableMockRecord < ActiveRecord::Base
set_table_name 'mock_records'
--
1.6.4.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment