Sha256: eb081bcf8d2b471a5206b737e05c7186467caf0cc59d657cddd6148a032c967e

Contents?: true

Size: 1.39 KB

Versions: 15

Compression:

Stored size: 1.39 KB

Contents

require 'cases/sqlserver_helper'
require 'models/author'
require 'models/post'
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

15 entries across 15 versions & 5 rubygems

Version Path
artpop-2000-2005-adapter-2.2.15 test/cases/eager_association_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.14 test/cases/eager_association_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.15 test/cases/eager_association_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.16 test/cases/eager_association_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.17 test/cases/eager_association_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.18 test/cases/eager_association_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.19 test/cases/eager_association_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.21 test/cases/eager_association_test_sqlserver.rb
rainux-2000-2005-adapter-2.2.15 test/cases/eager_association_test_sqlserver.rb
rainux-rails-sqlserver-2000-2005-2008-adapter-2.2.15 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.2.22 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.2.21 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.2.20 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.2.19 test/cases/eager_association_test_sqlserver.rb
activerecord-sqlserver-adapter-2.2.18 test/cases/eager_association_test_sqlserver.rb