From f30b7a31bda74715c09759d03064f6f7c7c784b9 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 23 Mar 2005 00:56:13 +0000 Subject: 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 --- activerecord/test/finder_test.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'activerecord/test/finder_test.rb') 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 -- cgit v1.2.3