aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/finder_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-03-23 00:56:13 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-03-23 00:56:13 +0000
commitf30b7a31bda74715c09759d03064f6f7c7c784b9 (patch)
tree720af60a1f2ca12c087af1d2d44ec0df98af9ebe /activerecord/test/finder_test.rb
parent4043b5cdb3152f09727b3fb0a5b43679cdea7406 (diff)
downloadrails-f30b7a31bda74715c09759d03064f6f7c7c784b9.tar.gz
rails-f30b7a31bda74715c09759d03064f6f7c7c784b9.tar.bz2
rails-f30b7a31bda74715c09759d03064f6f7c7c784b9.zip
Fixed the MS SQL adapter to work with the new limit/offset approach and with binary data (still suffering from 7KB limit, though) #901 [delynnb]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@982 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/finder_test.rb')
-rwxr-xr-xactiverecord/test/finder_test.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/activerecord/test/finder_test.rb b/activerecord/test/finder_test.rb
index de6d240faa..6b6b58a9c8 100755
--- a/activerecord/test/finder_test.rb
+++ b/activerecord/test/finder_test.rb
@@ -2,10 +2,11 @@ require 'abstract_unit'
require 'fixtures/company'
require 'fixtures/topic'
require 'fixtures/entrant'
+require 'fixtures/developer'
class FinderTest < Test::Unit::TestCase
fixtures :companies, :topics, :entrants, :developers
-
+
def test_find
assert_equal(@topics["first"]["title"], Topic.find(1).title)
end
@@ -43,10 +44,10 @@ class FinderTest < Test::Unit::TestCase
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 nil, "id ASC", ["? OFFSET ?", 2, 1] }
+ assert_raises(ArgumentError) { Entrant.find_all nil, "id ASC", [2, 1] }
end
else
- entrants = Entrant.find_all nil, "id ASC", ["? OFFSET ?", 2, 1]
+ entrants = Entrant.find_all nil, "id ASC", [2, 1]
assert_equal(2, entrants.size)
assert_equal(@entrants["second"]["name"], entrants.first.name)
@@ -256,11 +257,11 @@ class FinderTest < Test::Unit::TestCase
assert_equal first_five_developers, Developer.find_all(nil, 'id ASC', [5])
assert_equal no_developers, Developer.find_all(nil, 'id ASC', [0])
end
-
+
def test_find_all_with_limit_and_offset
first_three_developers = Developer.find_all nil, 'id ASC', [3, 0]
second_three_developers = Developer.find_all nil, 'id ASC', [3, 3]
- last_two_developers = Developer.find_all nil, 'id ASC', [3, 8]
+ last_two_developers = Developer.find_all nil, 'id ASC', [2, 8]
assert_equal 3, first_three_developers.length
assert_equal 3, second_three_developers.length