Skip to content

Commit c43985d

Browse files
committed
[Rails3] Removing some old test cases which would be pushed to rails/ar and renaming a few files.
1 parent 0fd86e7 commit c43985d

8 files changed

+15
-141
lines changed
Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,21 @@
11
require 'cases/sqlserver_helper'
2-
require 'models/topic'
2+
require 'models/developer'
33

44
class AttributeMethodsTestSqlserver < ActiveRecord::TestCase
55
end
66

77
class AttributeMethodsTest < ActiveRecord::TestCase
88

9-
COERCED_TESTS = [
10-
:test_typecast_attribute_from_select_to_false,
11-
:test_typecast_attribute_from_select_to_true
12-
]
9+
COERCED_TESTS = [:test_read_attributes_before_type_cast_on_datetime]
1310

1411
include SqlserverCoercedTest
1512

16-
fixtures :topics
13+
fixtures :developers
1714

18-
19-
def test_coerced_typecast_attribute_from_select_to_false
20-
topic = Topic.create(:title => 'Budget')
21-
topic = Topic.find(:first, :select => "topics.*, CASE WHEN 1=2 THEN 1 ELSE 0 END as is_test")
22-
assert !topic.is_test?
23-
end
24-
25-
def test_coerced_typecast_attribute_from_select_to_true
26-
topic = Topic.create(:title => 'Budget')
27-
topic = Topic.find(:first, :select => "topics.*, CASE WHEN 2=2 THEN 1 ELSE 0 END as is_test")
28-
assert topic.is_test?
15+
def test_coerced_test_read_attributes_before_type_cast_on_datetime
16+
developer = Developer.find(:first)
17+
assert_equal "#{developer.created_at.to_s(:db)}.000" , developer.attributes_before_type_cast["created_at"]
2918
end
3019

3120

3221
end
33-

test/cases/basics_test_sqlserver.rb

Lines changed: 0 additions & 21 deletions
This file was deleted.

test/cases/calculations_test_sqlserver.rb

Lines changed: 0 additions & 20 deletions
This file was deleted.

test/cases/eager_association_test_sqlserver.rb

Lines changed: 0 additions & 24 deletions
This file was deleted.

test/cases/inheritance_test_sqlserver.rb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ class InheritanceTestSqlserver < ActiveRecord::TestCase
77
class InheritanceTest < ActiveRecord::TestCase
88

99
COERCED_TESTS = [
10-
:test_eager_load_belongs_to_primary_key_quoting,
11-
:test_a_bad_type_column
10+
:test_eager_load_belongs_to_primary_key_quoting
1211
]
1312

1413
include SqlserverCoercedTest
@@ -19,10 +18,5 @@ def test_coerced_test_eager_load_belongs_to_primary_key_quoting
1918
end
2019
end
2120

22-
def test_coerced_test_a_bad_type_column
23-
Company.connection.insert "INSERT INTO [companies] ([id], #{QUOTED_TYPE}, [name]) VALUES(100, 'bad_class!', 'Not happening')"
24-
assert_raises(ActiveRecord::SubclassNotFound) { Company.find(100) }
25-
end
26-
2721

2822
end

test/cases/migration_test_sqlserver.rb

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -64,26 +64,6 @@ def setup
6464
end
6565

6666

67-
class MigrationTest < ActiveRecord::TestCase
68-
69-
COERCED_TESTS = [:test_add_column_not_null_without_default]
70-
71-
include SqlserverCoercedTest
72-
73-
def test_coerced_test_add_column_not_null_without_default
74-
Person.connection.create_table :testings do |t|
75-
t.column :foo, :string
76-
t.column :bar, :string, :null => false
77-
end
78-
assert_raises(ActiveRecord::StatementInvalid) do
79-
Person.connection.execute "INSERT INTO [testings] ([foo], [bar]) VALUES ('hello', NULL)"
80-
end
81-
ensure
82-
Person.connection.drop_table :testings rescue nil
83-
end
84-
85-
end
86-
8767
class ChangeTableMigrationsTest < ActiveRecord::TestCase
8868

8969
COERCED_TESTS = [:test_string_creates_string_column]

test/cases/query_cache_test_sqlserver.rb

Lines changed: 0 additions & 24 deletions
This file was deleted.

test/cases/validations_test_sqlserver.rb renamed to test/cases/uniqueness_validation_test_sqlserver.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
# encoding: utf-8
12
require 'cases/sqlserver_helper'
23

3-
class ValidationsTestSqlserver < ActiveRecord::TestCase
4+
class UniquenessValidationTestSqlserver < ActiveRecord::TestCase
45
end
56

6-
class ValidationsTest < ActiveRecord::TestCase
7+
class UniquenessValidationTest < ActiveRecord::TestCase
78

8-
COERCED_TESTS = [:test_validate_uniqueness_with_limit_and_utf8]
9+
# COERCED_TESTS = [:test_validate_uniqueness_with_limit_and_utf8]
910

10-
include SqlserverCoercedTest
11+
# include SqlserverCoercedTest
1112

1213
# This test is tricky to pass. The validation SQL would generate something like this:
1314
#
@@ -27,9 +28,9 @@ class ValidationsTest < ActiveRecord::TestCase
2728
# code to infer if the passed in string is indeed a national/unicde type. Perhaps in rails 3
2829
# and using AREL this might get better, but I do not see a solution right now.
2930
#
30-
def test_coerced_test_validate_uniqueness_with_limit_and_utf8
31-
assert true
32-
end
31+
# def test_coerced_test_validate_uniqueness_with_limit_and_utf8
32+
# assert true
33+
# end
3334

3435
end
3536

0 commit comments

Comments
 (0)