Permalink
Browse files

Get rake test:oracle_enhanced running (but not passing :)

  • Loading branch information...
1 parent aa7dc7b commit a05e49bbe21ef12f17958222462afb4e24f791ac Steve Halasz committed May 27, 2011
View
@@ -3,14 +3,17 @@ source :gemcutter
gem "activerecord", "~> 3.0.0"
group :development do
- gem "rake"
+ # http://stackoverflow.com/questions/6085610/rails-rake-problems-uninitialized-constant-rakedsl
+ gem "rake", "0.8.7"
gem "jeweler", ">= 1.4.0"
end
group :test do
# Database Adapters
gem "mysql", "~> 2.8.1"
gem "mysql2", "~> 0.2.4"
+ gem 'activerecord-oracle_enhanced-adapter', '>=1.3.1'
+ gem 'ruby-oci8'
gem "pg", "~> 0.9.0"
gem "sqlite3-ruby", "~> 1.3.1"
View
@@ -10,6 +10,7 @@ GEM
activesupport (= 3.0.1)
arel (~> 1.0.0)
tzinfo (~> 0.3.23)
+ activerecord-oracle_enhanced-adapter (1.3.2)
activesupport (3.0.1)
archive-tar-minitar (0.5.2)
arel (1.0.1)
@@ -45,6 +46,7 @@ GEM
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
ruby-debug-base19 (>= 0.11.19)
+ ruby-oci8 (2.0.4)
ruby_core_source (0.1.4)
archive-tar-minitar (>= 0.5.2)
rubyforge (2.0.4)
@@ -57,13 +59,15 @@ PLATFORMS
DEPENDENCIES
activerecord (~> 3.0.0)
+ activerecord-oracle_enhanced-adapter (>= 1.3.1)
delorean (~> 0.2.0)
factory_girl (~> 1.3.3)
jeweler (>= 1.4.0)
mysql (~> 2.8.1)
mysql2 (~> 0.2.4)
pg (~> 0.9.0)
- rake
+ rake (= 0.8.7)
ruby-debug (~> 0.9.3)
ruby-debug19
+ ruby-oci8
sqlite3-ruby (~> 1.3.1)
View
@@ -1,3 +1,4 @@
+require "rubygems"
require "bundler"
Bundler.setup
@@ -36,7 +37,7 @@ namespace :display do
end
task :default => ["display:notice"]
-ADAPTERS = %w(mysql mysql2 postgresql sqlite3)
+ADAPTERS = %w(mysql mysql2 oracle_enhanced postgresql sqlite3)
ADAPTERS.each do |adapter|
namespace :test do
desc "Runs #{adapter} database tests."
@@ -1,4 +1,4 @@
-module ActiveRecord::Import::PostgreSQLAdapter
+module ActiveRecord::Import::OracleEnhancedAdapter
module InstanceMethods
def self.included(klass)
klass.instance_eval do
@@ -15,8 +15,7 @@ def self.require_adapter(adapter)
def self.load_from_connection(connection)
import_adapter = "ActiveRecord::Import::#{connection.class.name.demodulize}::InstanceMethods"
unless connection.class.ancestors.map(&:name).include?(import_adapter)
- config = connection.instance_variable_get :@config
- require_adapter config[:adapter]
+ require_adapter connection.adapter_name.underscore
end
end
end
@@ -25,4 +24,4 @@ def self.load_from_connection(connection)
this_dir = Pathname.new File.dirname(__FILE__)
require this_dir.join("import")
require this_dir.join("active_record/adapters/abstract_adapter")
-require this_dir.join("synchronize")
+require this_dir.join("synchronize")
@@ -0,0 +1 @@
+ENV["ARE_DB"] = "oracle_enhanced"
@@ -19,9 +19,10 @@ postgresql:
adapter: postgresql
min_messages: warning
-oracle:
- <<: *common
- adapter: oracle
+oracle_enhanced:
+ adapter: oracle_enhanced
+ username: arimport
+ database: <tnsname>
min_messages: debug
sqlite:
@@ -0,0 +1,20 @@
+require File.expand_path('../../test_helper', __FILE__)
+
+describe "#supports_imports?" do
+ it "should support import" do
+ assert ActiveRecord::Base.supports_import?
+ end
+end
+
+describe "#import" do
+ it "should import with a single insert" do
+ # see ActiveRecord::ConnectionAdapters::AbstractAdapter test for more specifics
+ assert_difference "Topic.count", +10 do
+ result = Topic.import Build(3, :topics)
+ assert_equal 1, result.num_inserts
+
+ result = Topic.import Build(7, :topics)
+ assert_equal 1, result.num_inserts
+ end
+ end
+end

0 comments on commit a05e49b

Please sign in to comment.