aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test')
-rwxr-xr-xactiverecord/test/base_test.rb12
-rw-r--r--activerecord/test/finder_test.rb18
-rw-r--r--activerecord/test/fixtures/db_definitions/create_oracle_db.bat5
-rw-r--r--activerecord/test/fixtures/db_definitions/create_oracle_db.sh5
-rw-r--r--activerecord/test/fixtures/db_definitions/oci.sql2
-rwxr-xr-xactiverecord/test/fixtures_test.rb5
-rw-r--r--activerecord/test/schema_dumper_test.rb21
7 files changed, 34 insertions, 34 deletions
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb
index 2a7c2ed670..ed81645c5e 100755
--- a/activerecord/test/base_test.rb
+++ b/activerecord/test/base_test.rb
@@ -594,7 +594,9 @@ class BasicsTest < Test::Unit::TestCase
attributes = { "last_read(1i)" => "2004", "last_read(2i)" => "6", "last_read(3i)" => "24" }
topic = Topic.find(1)
topic.attributes = attributes
- assert_equal Date.new(2004, 6, 24).to_s, topic.last_read.to_s
+ # note that extra #to_date call allows test to pass for Oracle, which
+ # treats dates/times the same
+ assert_equal Date.new(2004, 6, 24).to_s, topic.last_read.to_date.to_s
end
def test_multiparameter_attributes_on_date_with_empty_date
@@ -606,7 +608,9 @@ class BasicsTest < Test::Unit::TestCase
attributes = { "last_read(1i)" => "2004", "last_read(2i)" => "6", "last_read(3i)" => "" }
topic = Topic.find(1)
topic.attributes = attributes
- assert_equal Date.new(2004, 6, 1).to_s, topic.last_read.to_s
+ # note that extra #to_date call allows test to pass for Oracle, which
+ # treats dates/times the same
+ assert_equal Date.new(2004, 6, 1).to_s, topic.last_read.to_date.to_s
end
def test_multiparameter_attributes_on_date_with_all_empty
@@ -647,8 +651,8 @@ class BasicsTest < Test::Unit::TestCase
def test_attributes_on_dummy_time
# Oracle does not have a TIME datatype.
- if ActiveRecord::ConnectionAdapters.const_defined? :OracleAdapter
- return true if ActiveRecord::Base.connection.instance_of?(ActiveRecord::ConnectionAdapters::OracleAdapter)
+ if ActiveRecord::ConnectionAdapters.const_defined? :OCIAdapter
+ return true if ActiveRecord::Base.connection.instance_of?(ActiveRecord::ConnectionAdapters::OCIAdapter)
end
# Sqlserver doesn't either .
if ActiveRecord::ConnectionAdapters.const_defined? :SQLServerAdapter
diff --git a/activerecord/test/finder_test.rb b/activerecord/test/finder_test.rb
index e1ec629fd5..bfaed76a56 100644
--- a/activerecord/test/finder_test.rb
+++ b/activerecord/test/finder_test.rb
@@ -47,20 +47,14 @@ class FinderTest < Test::Unit::TestCase
end
def test_find_all_with_prepared_limit_and_offset
- if ActiveRecord::ConnectionAdapters.const_defined? :OracleAdapter
- if ActiveRecord::Base.connection.instance_of?(ActiveRecord::ConnectionAdapters::OracleAdapter)
- assert_raises(ArgumentError) { Entrant.find(:all, :order => 'id ASC', :limit => 2, :offset => 1) }
- end
- else
- entrants = Entrant.find(:all, :order => "id ASC", :limit => 2, :offset => 1)
+ entrants = Entrant.find(:all, :order => "id ASC", :limit => 2, :offset => 1)
- assert_equal(2, entrants.size)
- assert_equal(entrants(:second).name, entrants.first.name)
+ assert_equal(2, entrants.size)
+ assert_equal(entrants(:second).name, entrants.first.name)
- entrants = Entrant.find(:all, :order => "id ASC", :limit => 2, :offset => 2)
- assert_equal(1, entrants.size)
- assert_equal(entrants(:third).name, entrants.first.name)
- end
+ entrants = Entrant.find(:all, :order => "id ASC", :limit => 2, :offset => 2)
+ assert_equal(1, entrants.size)
+ assert_equal(entrants(:third).name, entrants.first.name)
end
def test_find_with_entire_select_statement
diff --git a/activerecord/test/fixtures/db_definitions/create_oracle_db.bat b/activerecord/test/fixtures/db_definitions/create_oracle_db.bat
index 25c7e18856..e69de29bb2 100644
--- a/activerecord/test/fixtures/db_definitions/create_oracle_db.bat
+++ b/activerecord/test/fixtures/db_definitions/create_oracle_db.bat
@@ -1,5 +0,0 @@
-sqlplus arunit/arunit @ drop_oracle_tables
-sqlplus arunit/arunit @ oracle
-sqlplus arunit2/arunit2 @ drop_oracle_tables2
-sqlplus arunit2/arunit2 @ oracle2
-
diff --git a/activerecord/test/fixtures/db_definitions/create_oracle_db.sh b/activerecord/test/fixtures/db_definitions/create_oracle_db.sh
index 25c7e18856..e69de29bb2 100644
--- a/activerecord/test/fixtures/db_definitions/create_oracle_db.sh
+++ b/activerecord/test/fixtures/db_definitions/create_oracle_db.sh
@@ -1,5 +0,0 @@
-sqlplus arunit/arunit @ drop_oracle_tables
-sqlplus arunit/arunit @ oracle
-sqlplus arunit2/arunit2 @ drop_oracle_tables2
-sqlplus arunit2/arunit2 @ oracle2
-
diff --git a/activerecord/test/fixtures/db_definitions/oci.sql b/activerecord/test/fixtures/db_definitions/oci.sql
index 8a8dcd0681..cedd92ad53 100644
--- a/activerecord/test/fixtures/db_definitions/oci.sql
+++ b/activerecord/test/fixtures/db_definitions/oci.sql
@@ -259,3 +259,5 @@ create table keyboards (
key_number integer not null,
name varchar(50) default null
);
+create sequence keyboards_seq minvalue 10000;
+
diff --git a/activerecord/test/fixtures_test.rb b/activerecord/test/fixtures_test.rb
index 888d743078..69ffcc6019 100755
--- a/activerecord/test/fixtures_test.rb
+++ b/activerecord/test/fixtures_test.rb
@@ -52,6 +52,11 @@ class FixturesTest < Test::Unit::TestCase
end
def test_inserts_with_pre_and_suffix
+ # not supported yet in OCI adapter
+ if ActiveRecord::ConnectionAdapters.const_defined? :OCIAdapter
+ return true if ActiveRecord::Base.connection.instance_of?(ActiveRecord::ConnectionAdapters::OCIAdapter)
+ end
+
ActiveRecord::Base.connection.create_table :prefix_topics_suffix do |t|
t.column :title, :string
t.column :author_name, :string
diff --git a/activerecord/test/schema_dumper_test.rb b/activerecord/test/schema_dumper_test.rb
index e24724c9f8..e57429a4c8 100644
--- a/activerecord/test/schema_dumper_test.rb
+++ b/activerecord/test/schema_dumper_test.rb
@@ -4,16 +4,21 @@ require 'stringio'
if ActiveRecord::Base.connection.respond_to?(:tables)
- class SchemaDumperTest < Test::Unit::TestCase
- def test_schema_dump
- stream = StringIO.new
- ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, stream)
- output = stream.string
+ unless ActiveRecord::ConnectionAdapters.const_defined?(:OCIAdapter) && \
+ ActiveRecord::Base.connection.instance_of?(ActiveRecord::ConnectionAdapters::OCIAdapter)
- assert_match %r{create_table "accounts"}, output
- assert_match %r{create_table "authors"}, output
- assert_no_match %r{create_table "schema_info"}, output
+ class SchemaDumperTest < Test::Unit::TestCase
+ def test_schema_dump
+ stream = StringIO.new
+ ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, stream)
+ output = stream.string
+
+ assert_match %r{create_table "accounts"}, output
+ assert_match %r{create_table "authors"}, output
+ assert_no_match %r{create_table "schema_info"}, output
+ end
end
+
end
end