Sha256: 693e43210f5bd19c4bbadde6c1ac01552647efbf8e089a538def1de71be69744

Contents?: true

Size: 1.39 KB

Versions: 21

Compression:

Stored size: 1.39 KB

Contents

require 'cases/sqlserver_helper'
require 'models/post'
require 'models/author'
require 'models/comment'

class EagerAssociationTestSqlserver < ActiveRecord::TestCase
end

class EagerAssociationTest < ActiveRecord::TestCase
  
  COERCED_TESTS = [
    :test_count_with_include,
    :test_eager_with_has_many_and_limit_and_high_offset_and_multiple_array_conditions,
    :test_eager_with_has_many_and_limit_and_high_offset_and_multiple_hash_conditions
  ]
  
  include SqlserverCoercedTest
  
  fixtures :authors, :posts, :comments
  
  def test_coerced_test_count_with_include
    assert_equal 3, authors(:david).posts_with_comments.count(:conditions => "len(comments.body) > 15")
  end
  
  def test_coerced_eager_with_has_many_and_limit_and_high_offset_and_multiple_array_conditions
    assert_queries(2) do
      posts = Post.find(:all, :include => [ :author, :comments ], :limit => 2, :offset => 10,
        :conditions => [ "authors.name = ? and comments.body = ?", 'David', 'go crazy' ])
      assert_equal 0, posts.size
    end
  end

  def test_coerced_eager_with_has_many_and_limit_and_high_offset_and_multiple_hash_conditions
    assert_queries(2) do
      posts = Post.find(:all, :include => [ :author, :comments ], :limit => 2, :offset => 10,
        :conditions => { 'authors.name' => 'David', 'comments.body' => 'go crazy' })
      assert_equal 0, posts.size
    end
  end unless active_record_2_point_2?
  
  
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
activerecord-sqlserver-adapter-2.3.21 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.20 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.19 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.18 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.17 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.16 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.15 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.13 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.12 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.11 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.10 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.9 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.8 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.7 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.6 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.5 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.4 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.3 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.2 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.1 test/cases/eager_association_test_sqlserver.rb