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
activerecord-sqlserver-adapter-2.3.13 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.12 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.11 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.10 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.9 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.8 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.7 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.6 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.5 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.4 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.3 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.2 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3.1 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.3 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.2.22 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.2.21 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.2.20 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.2.19 test/cases/attribute_methods_test_sqlserver.rb
activerecord-sqlserver-adapter-2.2.18 test/cases/attribute_methods_test_sqlserver.rb