activerecord-jdbc-adapter 1.2.2.1 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -2
- data/.travis.yml +18 -3
- data/Appraisals +16 -0
- data/Gemfile +10 -10
- data/Gemfile.lock +27 -17
- data/LICENSE.txt +20 -17
- data/README.rdoc +29 -14
- data/Rakefile +4 -4
- data/activerecord-jdbc-adapter.gemspec +2 -1
- data/gemfiles/rails23.gemfile +12 -0
- data/gemfiles/rails23.gemfile.lock +44 -0
- data/gemfiles/rails30.gemfile +11 -0
- data/gemfiles/rails30.gemfile.lock +39 -0
- data/gemfiles/rails31.gemfile +11 -0
- data/gemfiles/rails31.gemfile.lock +41 -0
- data/gemfiles/rails32.gemfile +11 -0
- data/gemfiles/rails32.gemfile.lock +41 -0
- data/lib/arel/visitors/sql_server.rb +7 -0
- data/lib/arjdbc/db2/adapter.rb +82 -32
- data/lib/arjdbc/derby.rb +0 -4
- data/lib/arjdbc/derby/adapter.rb +1 -1
- data/lib/arjdbc/derby/connection_methods.rb +3 -2
- data/lib/arjdbc/discover.rb +16 -1
- data/lib/arjdbc/firebird/adapter.rb +5 -1
- data/lib/arjdbc/h2.rb +0 -1
- data/lib/arjdbc/h2/connection_methods.rb +3 -1
- data/lib/arjdbc/hsqldb.rb +0 -1
- data/lib/arjdbc/hsqldb/adapter.rb +4 -3
- data/lib/arjdbc/hsqldb/connection_methods.rb +3 -3
- data/lib/arjdbc/informix/adapter.rb +5 -1
- data/lib/arjdbc/jdbc/adapter.rb +22 -24
- data/lib/arjdbc/jdbc/adapter_java.jar +0 -0
- data/lib/arjdbc/jdbc/base_ext.rb +1 -1
- data/lib/arjdbc/jdbc/connection.rb +23 -29
- data/lib/arjdbc/jdbc/core_ext.rb +1 -1
- data/lib/arjdbc/jdbc/discover.rb +1 -1
- data/lib/arjdbc/jdbc/driver.rb +1 -1
- data/lib/arjdbc/jdbc/extension.rb +3 -3
- data/lib/arjdbc/jdbc/jdbc.rake +15 -5
- data/lib/arjdbc/mssql.rb +0 -1
- data/lib/arjdbc/mssql/adapter.rb +10 -4
- data/lib/arjdbc/mssql/connection_methods.rb +15 -15
- data/lib/arjdbc/mssql/limit_helpers.rb +24 -2
- data/lib/arjdbc/mssql/tsql_helper.rb +0 -8
- data/lib/arjdbc/mysql.rb +0 -1
- data/lib/arjdbc/mysql/adapter.rb +82 -0
- data/lib/arjdbc/mysql/connection_methods.rb +3 -4
- data/lib/arjdbc/oracle/adapter.rb +12 -2
- data/lib/arjdbc/postgresql.rb +0 -1
- data/lib/arjdbc/postgresql/adapter.rb +127 -27
- data/lib/arjdbc/postgresql/connection_methods.rb +3 -4
- data/lib/arjdbc/sqlite3.rb +0 -1
- data/lib/arjdbc/sqlite3/adapter.rb +13 -14
- data/lib/arjdbc/sqlite3/connection_methods.rb +3 -4
- data/lib/arjdbc/version.rb +1 -1
- data/rakelib/01-tomcat.rake +52 -0
- data/rakelib/02-test.rake +111 -0
- data/rakelib/db.rake +4 -3
- data/src/java/arjdbc/db2/DB2RubyJdbcConnection.java +7 -0
- data/src/java/arjdbc/jdbc/RubyJdbcConnection.java +8 -3
- data/test/abstract_db_create.rb +5 -1
- data/test/activerecord/connection_adapters/type_conversion_test.rb +0 -1
- data/test/activerecord/jall.sh +0 -0
- data/test/activerecord/jtest.sh +0 -0
- data/test/db/db2.rb +2 -0
- data/test/db/derby.rb +3 -5
- data/test/db/h2.rb +3 -1
- data/test/db/hsqldb.rb +2 -0
- data/test/db/informix.rb +2 -0
- data/test/db/jdbc.rb +11 -10
- data/test/db/jdbc_derby.rb +14 -0
- data/test/db/jdbc_h2.rb +17 -0
- data/test/db/jdbc_mysql.rb +13 -0
- data/test/db/jdbc_postgres.rb +23 -0
- data/test/db/jndi_config.rb +28 -33
- data/test/db/jndi_pooled_config.rb +35 -0
- data/test/db/logger.rb +1 -1
- data/test/db/mssql.rb +2 -0
- data/test/db/mysql.rb +2 -7
- data/test/db/mysql_config.rb +7 -0
- data/test/db/oracle.rb +2 -0
- data/test/db/postgres.rb +9 -7
- data/test/db/postgres_config.rb +10 -0
- data/test/db/sqlite3.rb +2 -0
- data/test/db2_reset_column_information_test.rb +0 -2
- data/test/derby_migration_test.rb +0 -1
- data/test/derby_multibyte_test.rb +0 -1
- data/test/derby_reset_column_information_test.rb +0 -3
- data/test/derby_row_locking_test.rb +0 -3
- data/test/derby_simple_test.rb +0 -1
- data/test/generic_jdbc_connection_test.rb +72 -17
- data/test/h2_change_column_test.rb +0 -1
- data/test/h2_simple_test.rb +0 -1
- data/test/helper.rb +22 -91
- data/test/jdbc_common.rb +98 -3
- data/test/jndi_callbacks_test.rb +6 -5
- data/test/jndi_test.rb +40 -15
- data/test/models/custom_pk_name.rb +14 -0
- data/test/mssql_ignore_system_views_test.rb +7 -4
- data/test/mssql_limit_offset_test.rb +30 -0
- data/test/mssql_multibyte_test.rb +1 -2
- data/test/mssql_reset_column_information_test.rb +0 -2
- data/test/mssql_row_locking_sql_test.rb +0 -2
- data/test/mssql_row_locking_test.rb +0 -2
- data/test/mysql_reset_column_information_test.rb +0 -2
- data/test/mysql_simple_test.rb +3 -18
- data/test/oracle_limit_test.rb +23 -0
- data/test/oracle_reset_column_information_test.rb +0 -2
- data/test/postgres_db_create_test.rb +0 -1
- data/test/postgres_drop_db_test.rb +0 -1
- data/test/postgres_information_schema_leak_test.rb +0 -1
- data/test/postgres_native_type_mapping_test.rb +17 -14
- data/test/postgres_nonseq_pkey_test.rb +0 -1
- data/test/postgres_reserved_test.rb +1 -2
- data/test/postgres_reset_column_information_test.rb +0 -3
- data/test/postgres_schema_search_path_test.rb +0 -1
- data/test/postgres_simple_test.rb +40 -1
- data/test/postgres_table_alias_length_test.rb +0 -1
- data/test/postgres_type_conversion_test.rb +0 -1
- data/test/row_locking.rb +6 -2
- data/test/simple.rb +57 -20
- data/test/sqlite3_reset_column_information_test.rb +0 -2
- data/test/sqlite3_simple_test.rb +1 -16
- data/test/sybase_reset_column_information_test.rb +0 -2
- metadata +366 -343
- data/lib/arjdbc/jdbc/require_driver.rb +0 -16
data/test/jdbc_common.rb
CHANGED
@@ -3,9 +3,10 @@ def jruby?
|
|
3
3
|
defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
|
4
4
|
end
|
5
5
|
|
6
|
+
require 'bundler'
|
7
|
+
Bundler.require(:default, :test)
|
6
8
|
require 'arjdbc' if jruby?
|
7
9
|
puts "Using activerecord version #{ActiveRecord::VERSION::STRING}"
|
8
|
-
puts "Specify version with AR_VERSION={version} or RUBYLIB={path}"
|
9
10
|
require 'models/auto_id'
|
10
11
|
require 'models/entry'
|
11
12
|
require 'models/data_types'
|
@@ -13,16 +14,110 @@ require 'models/add_not_null_column_to_table'
|
|
13
14
|
require 'models/validates_uniqueness_of_string'
|
14
15
|
require 'models/string_id'
|
15
16
|
require 'models/thing'
|
17
|
+
require 'models/custom_pk_name'
|
16
18
|
require 'simple'
|
17
19
|
require 'has_many_through'
|
18
20
|
require 'helper'
|
19
21
|
require 'row_locking'
|
20
22
|
require 'test/unit'
|
23
|
+
require 'logger'
|
21
24
|
|
22
|
-
#
|
25
|
+
# we always require logger (some tests fail if ActiveRecord::Base.logger is nil), but level
|
26
|
+
# is set to warn unless $DEBUG or ENV['DEBUG'] is set
|
27
|
+
require 'db/logger'
|
23
28
|
if $DEBUG || ENV['DEBUG']
|
24
|
-
require 'db/logger'
|
25
29
|
require 'ruby-debug'
|
26
30
|
end
|
27
31
|
|
32
|
+
# assert_queries and SQLCounter taken from rails active_record tests
|
33
|
+
class Test::Unit::TestCase
|
34
|
+
def assert_queries(num = 1, matching = nil)
|
35
|
+
if !ActiveRecord::SQLCounter.enabled?
|
36
|
+
warn "SQLCounter assert_queries skipped"
|
37
|
+
return
|
38
|
+
end
|
39
|
+
|
40
|
+
ActiveRecord::SQLCounter.log = []
|
41
|
+
yield
|
42
|
+
ensure
|
43
|
+
queries = nil
|
44
|
+
ActiveRecord::SQLCounter.log.tap {|log| queries = (matching ? log.select {|s| s =~ matching } : log) }
|
45
|
+
assert_equal num, queries.size, "#{queries.size} instead of #{num} queries were executed.#{queries.size == 0 ? '' : "\nQueries:\n#{queries.join("\n")}"}"
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.ar_version(version)
|
49
|
+
match = version.match(/(\d+)\.(\d+)(?:\.(\d+))?/)
|
50
|
+
ActiveRecord::VERSION::MAJOR > match[1].to_i ||
|
51
|
+
(ActiveRecord::VERSION::MAJOR == match[1].to_i &&
|
52
|
+
ActiveRecord::VERSION::MINOR >= match[2].to_i)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
module ActiveRecord
|
57
|
+
class SQLCounter
|
58
|
+
@@enabled = true
|
59
|
+
def self.enabled?
|
60
|
+
@@enabled
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.ignored_sql
|
64
|
+
@@ignored_sql
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.ignored_sql=(value)
|
68
|
+
@@ignored_sql = value
|
69
|
+
end
|
70
|
+
|
71
|
+
self.ignored_sql = [
|
72
|
+
/^PRAGMA (?!(table_info))/,
|
73
|
+
/^SELECT currval/,
|
74
|
+
/^SELECT CAST/,
|
75
|
+
/^SELECT @@IDENTITY/,
|
76
|
+
/^SELECT @@ROWCOUNT/,
|
77
|
+
/^SAVEPOINT/,
|
78
|
+
/^ROLLBACK TO SAVEPOINT/,
|
79
|
+
/^RELEASE SAVEPOINT/,
|
80
|
+
/^SHOW max_identifier_length/,
|
81
|
+
/^BEGIN/,
|
82
|
+
/^COMMIT/
|
83
|
+
]
|
84
|
+
|
85
|
+
# FIXME: this needs to be refactored so specific database can add their own
|
86
|
+
# ignored SQL. This ignored SQL is for Oracle.
|
87
|
+
ignored_sql.concat [/^select .*nextval/i,
|
88
|
+
/^SAVEPOINT/,
|
89
|
+
/^ROLLBACK TO/,
|
90
|
+
/^\s*select .* from all_triggers/im
|
91
|
+
]
|
92
|
+
|
93
|
+
def self.log=(v)
|
94
|
+
@@log = v
|
95
|
+
end
|
96
|
+
|
97
|
+
def self.log
|
98
|
+
@@log
|
99
|
+
end
|
100
|
+
|
101
|
+
self.log = []
|
102
|
+
|
103
|
+
def call(name, start, finish, message_id, values)
|
104
|
+
sql = values[:sql]
|
105
|
+
|
106
|
+
# FIXME: this seems bad. we should probably have a better way to indicate
|
107
|
+
# the query was cached
|
108
|
+
unless 'CACHE' == values[:name]
|
109
|
+
self.class.log << sql unless self.class.ignored_sql.
|
110
|
+
any? { |r| sql =~ r }
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
begin
|
116
|
+
require 'active_support/notifications'
|
117
|
+
ActiveSupport::Notifications.subscribe('sql.active_record', SQLCounter.new)
|
118
|
+
rescue LoadError
|
119
|
+
@@enabled = false
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
28
123
|
|
data/test/jndi_callbacks_test.rb
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
require 'jdbc_common'
|
2
2
|
require 'db/jndi_config'
|
3
3
|
|
4
|
-
|
5
|
-
require 'mocha'
|
4
|
+
require 'mocha'
|
6
5
|
|
7
6
|
class JndiConnectionPoolCallbacksTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def self.startup
|
9
|
+
ActiveRecord::Base.establish_connection JNDI_CONFIG
|
10
|
+
end
|
11
|
+
|
8
12
|
def setup
|
9
13
|
@logger = stub_everything "logger"
|
10
14
|
@config = JNDI_CONFIG
|
@@ -29,8 +33,5 @@ class JndiConnectionPoolCallbacksTest < Test::Unit::TestCase
|
|
29
33
|
Entry.connection_pool.checkin @adapter
|
30
34
|
assert !@connection.active?
|
31
35
|
end
|
32
|
-
end
|
33
36
|
|
34
|
-
rescue LoadError
|
35
|
-
warn "mocha not found, disabling mocha-based tests"
|
36
37
|
end if ActiveRecord::Base.respond_to?(:connection_pool)
|
data/test/jndi_test.rb
CHANGED
@@ -1,25 +1,50 @@
|
|
1
|
-
# In order to run these tests, you need to have a few things on your
|
2
|
-
# classpath. First, you're going to need the Sun File system
|
3
|
-
# context. You can get that here:
|
4
|
-
#
|
5
|
-
# http://java.sun.com/products/jndi/serviceproviders.html.
|
6
|
-
#
|
7
|
-
# Make sure that you put both the fscontext.jar and the
|
8
|
-
# providerutil.jar on your classpath.
|
9
|
-
#
|
10
1
|
# To support the connection pooling in the test, you'll need
|
11
2
|
# commons-dbcp, commons-pool, and commons-collections.
|
12
|
-
#
|
13
|
-
# Finally, you'll need the jdbc driver, which is derby, for this test.
|
14
3
|
|
15
4
|
require 'jdbc_common'
|
5
|
+
|
16
6
|
require 'db/jndi_config'
|
17
7
|
|
18
8
|
class DerbyJndiTest < Test::Unit::TestCase
|
19
9
|
include SimpleTestMethods
|
10
|
+
|
11
|
+
def self.startup
|
12
|
+
ActiveRecord::Base.establish_connection JNDI_CONFIG
|
13
|
+
end
|
14
|
+
|
15
|
+
test "(raw) connection is a jndi connection" do
|
16
|
+
connection = ActiveRecord::Base.connection.raw_connection
|
17
|
+
assert_true connection.jndi_connection?
|
18
|
+
end
|
19
|
+
|
20
|
+
test "fills username from data source meta-data if missing" do
|
21
|
+
connection = ActiveRecord::Base.connection.raw_connection
|
22
|
+
assert_true connection.jndi_connection?
|
23
|
+
|
24
|
+
config = { :jndi => JNDI_CONFIG[:jndi] }
|
25
|
+
ArJdbc::Derby.adapter_matcher('Derby', config)
|
26
|
+
assert_equal 'sa', config[:username]
|
27
|
+
|
28
|
+
# but only for Derby of course :
|
29
|
+
config = { :jndi => JNDI_CONFIG[:jndi] }
|
30
|
+
ArJdbc::Derby.adapter_matcher('DB42', config)
|
31
|
+
assert_nil config[:username]
|
32
|
+
end
|
33
|
+
|
20
34
|
end
|
21
35
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
36
|
+
require 'db/jndi_pooled_config'
|
37
|
+
|
38
|
+
class DerbyJndiPooledTest < Test::Unit::TestCase
|
39
|
+
include SimpleTestMethods
|
40
|
+
|
41
|
+
def self.startup
|
42
|
+
ActiveRecord::Base.establish_connection JNDI_POOLED_CONFIG
|
43
|
+
end
|
44
|
+
|
45
|
+
test "(raw) connection is a jndi connection" do
|
46
|
+
connection = ActiveRecord::Base.connection.raw_connection
|
47
|
+
assert_true connection.jndi_connection?
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateCustomPkName < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :custom_pk_names, :force => true, :id => false do |t|
|
4
|
+
t.primary_key :custom_id
|
5
|
+
t.string :name
|
6
|
+
end
|
7
|
+
end
|
8
|
+
def self.down
|
9
|
+
drop_table :custom_pk_names
|
10
|
+
end
|
11
|
+
end
|
12
|
+
class CustomPkName < ActiveRecord::Base
|
13
|
+
self.primary_key = "custom_id"
|
14
|
+
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
#! /usr/bin/env jruby
|
2
|
-
|
3
1
|
require 'jdbc_common'
|
4
2
|
require 'db/mssql'
|
5
3
|
|
@@ -8,8 +6,13 @@ class IgnoreSystemViewsTest < Test::Unit::TestCase
|
|
8
6
|
include MigrationSetup
|
9
7
|
|
10
8
|
def test_system_views_ignored
|
11
|
-
|
12
|
-
|
9
|
+
if ActiveRecord::Base.connection.sqlserver_version == "2000"
|
10
|
+
assert_equal false, table_exists?("sys.views"), %{table_exists?("sys.views")}
|
11
|
+
assert_equal false, table_exists?("information_schema.views"), %{table_exists?("information_schema.views")}
|
12
|
+
else
|
13
|
+
assert_equal true, table_exists?("sys.views"), %{table_exists?("sys.views")}
|
14
|
+
assert_equal true, table_exists?("information_schema.views"), %{table_exists?("information_schema.views")}
|
15
|
+
end
|
13
16
|
assert_equal false, table_exists?("dbo.views"), %{table_exists?("dbo.views")}
|
14
17
|
assert_equal false, table_exists?(:views), %{table_exists?(:views)}
|
15
18
|
ActiveRecord::Schema.define { suppress_messages { create_table :views } }
|
@@ -3,6 +3,26 @@ require 'db/mssql'
|
|
3
3
|
|
4
4
|
ActiveRecord::Schema.verbose = false
|
5
5
|
|
6
|
+
class CreateLegacyShips < ActiveRecord::Migration
|
7
|
+
|
8
|
+
def self.up
|
9
|
+
create_table "legacy_ships",{:primary_key => :ShipKey} do |t|
|
10
|
+
t.string "name", :limit => 50, :null => false
|
11
|
+
t.integer "width", :default => 123
|
12
|
+
t.integer "length", :default => 456
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.down
|
17
|
+
drop_table "legacy_ships"
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
class LegacyShip < ActiveRecord::Base
|
23
|
+
self.primary_key = "ShipKey"
|
24
|
+
end
|
25
|
+
|
6
26
|
class CreateLongShips < ActiveRecord::Migration
|
7
27
|
|
8
28
|
def self.up
|
@@ -64,6 +84,7 @@ end
|
|
64
84
|
class MsSQLLimitOffsetTest < Test::Unit::TestCase
|
65
85
|
|
66
86
|
def setup
|
87
|
+
CreateLegacyShips.up
|
67
88
|
CreateLongShips.up
|
68
89
|
CreateVikings.up
|
69
90
|
CreateNoIdVikings.up
|
@@ -71,6 +92,7 @@ class MsSQLLimitOffsetTest < Test::Unit::TestCase
|
|
71
92
|
end
|
72
93
|
|
73
94
|
def teardown
|
95
|
+
CreateLegacyShips.down
|
74
96
|
CreateVikings.down
|
75
97
|
CreateLongShips.down
|
76
98
|
CreateNoIdVikings.down
|
@@ -84,6 +106,14 @@ class MsSQLLimitOffsetTest < Test::Unit::TestCase
|
|
84
106
|
end
|
85
107
|
end
|
86
108
|
|
109
|
+
def test_limit_with_alternate_named_primary_key
|
110
|
+
%w(one two three four five six seven eight).each do |name|
|
111
|
+
LegacyShip.create!(:name => name)
|
112
|
+
end
|
113
|
+
ships = LegacyShip.limit(3)
|
114
|
+
assert_equal(3, ships.size)
|
115
|
+
end
|
116
|
+
|
87
117
|
def test_limit_and_offset
|
88
118
|
%w(one two three four five six seven eight).each do |name|
|
89
119
|
LongShip.create!(:name => name)
|
data/test/mysql_simple_test.rb
CHANGED
@@ -12,6 +12,7 @@ class MysqlSimpleTest < Test::Unit::TestCase
|
|
12
12
|
include SimpleTestMethods
|
13
13
|
include ActiveRecord3TestMethods
|
14
14
|
include ColumnNameQuotingTests
|
15
|
+
include XmlColumnTests
|
15
16
|
|
16
17
|
column_quote_char "`"
|
17
18
|
|
@@ -42,7 +43,7 @@ class MysqlSimpleTest < Test::Unit::TestCase
|
|
42
43
|
assert_nothing_raised { Entry.update_all({:title => "test"}, {}, {:limit => 1}) }
|
43
44
|
end
|
44
45
|
|
45
|
-
# from rails active record tests
|
46
|
+
# from rails active record tests, only meant to work in AR 3.2 and higher
|
46
47
|
def test_update_all_with_joins_and_offset_and_order
|
47
48
|
user_1 = User.create :login => 'user_1'
|
48
49
|
user_2 = User.create :login => 'user_2'
|
@@ -59,7 +60,7 @@ class MysqlSimpleTest < Test::Unit::TestCase
|
|
59
60
|
|
60
61
|
assert_equal count - 1, entries.update_all(:user_id => user_2.id)
|
61
62
|
assert_equal user_2, Entry.find_by_title('title_2').user
|
62
|
-
end
|
63
|
+
end if ar_version("3.2")
|
63
64
|
|
64
65
|
# from rails active record tests
|
65
66
|
def test_caching_of_columns
|
@@ -102,22 +103,6 @@ class MysqlSimpleTest < Test::Unit::TestCase
|
|
102
103
|
User.table_name = old_users_table_name
|
103
104
|
end
|
104
105
|
end
|
105
|
-
|
106
|
-
def test_create_xml_column
|
107
|
-
assert_nothing_raised do
|
108
|
-
@connection.create_table :xml_testings do |t|
|
109
|
-
t.xml :xml_test
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
xml_test = @connection.columns(:xml_testings).detect do |c|
|
114
|
-
c.name == "xml_test"
|
115
|
-
end
|
116
|
-
|
117
|
-
assert_equal "text", xml_test.sql_type
|
118
|
-
ensure
|
119
|
-
@connection.drop_table :xml_testings rescue nil
|
120
|
-
end
|
121
106
|
end
|
122
107
|
|
123
108
|
class MysqlHasManyThroughTest < Test::Unit::TestCase
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'jdbc_common'
|
2
|
+
require 'db/oracle'
|
3
|
+
|
4
|
+
class OracleLimitTest < Test::Unit::TestCase
|
5
|
+
include FixtureSetup
|
6
|
+
|
7
|
+
def setup
|
8
|
+
super
|
9
|
+
|
10
|
+
1010.times do |n|
|
11
|
+
Entry.create!(:user => User.create!(:login => "Test User#{n}"),
|
12
|
+
:title => "Entry #{n}",
|
13
|
+
:rating => n,
|
14
|
+
:content => "Testing Content #{n}")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_oracle_limit_properly_handled
|
19
|
+
assert_nothing_thrown do
|
20
|
+
Entry.includes(:user).all
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|