Sha256: 96600f812ed329facb34542c9ce5e4a1c511b2eb0a5a3f6c5a60da85f8182448

Contents?: true

Size: 844 Bytes

Versions: 39

Compression:

Stored size: 844 Bytes

Contents

require 'cases/sqlserver_helper'
require 'models/topic'

class AttributeMethodsTestSqlserver < ActiveRecord::TestCase
end

class AttributeMethodsTest < ActiveRecord::TestCase
  
  COERCED_TESTS = [
    :test_typecast_attribute_from_select_to_false,
    :test_typecast_attribute_from_select_to_true
  ]
  
  include SqlserverCoercedTest
  
  fixtures :topics
  
  
  def test_coerced_typecast_attribute_from_select_to_false
    topic = Topic.create(:title => 'Budget')
    topic = Topic.find(:first, :select => "topics.*, CASE WHEN 1=2 THEN 1 ELSE 0 END as is_test")
    assert !topic.is_test?
  end

  def test_coerced_typecast_attribute_from_select_to_true
    topic = Topic.create(:title => 'Budget')
    topic = Topic.find(:first, :select => "topics.*, CASE WHEN 2=2 THEN 1 ELSE 0 END as is_test")
    assert topic.is_test?
  end
  
  
end

Version data entries

39 entries across 39 versions & 5 rubygems

Version Path
artpop-2000-2005-adapter-2.2.15 test/cases/attribute_methods_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.14 test/cases/attribute_methods_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.15 test/cases/attribute_methods_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.16 test/cases/attribute_methods_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.17 test/cases/attribute_methods_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.18 test/cases/attribute_methods_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.19 test/cases/attribute_methods_test_sqlserver.rb
rails-sqlserver-2000-2005-adapter-2.2.21 test/cases/attribute_methods_test_sqlserver.rb
rainux-2000-2005-adapter-2.2.15 test/cases/attribute_methods_test_sqlserver.rb
rainux-rails-sqlserver-2000-2005-2008-adapter-2.2.15 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.24 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.23 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.22 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.21 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.20 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.19 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.18 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.17 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.16 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.15 test/cases/attribute_methods_test_sqlserver.rb