Skip to content

Commit 17eaddc

Browse files
committed
Missing files from last commit.
1 parent e88c19f commit 17eaddc

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module ActiveRecord
2+
module ConnectionAdapters
3+
module SQLServer
4+
module Type
5+
class Real < Float
6+
7+
include Castable
8+
9+
def type
10+
:real
11+
end
12+
13+
end
14+
end
15+
end
16+
end
17+
end
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
require 'cases/helper_sqlserver'
2+
require 'cases/schema_dumper_test'
3+
require 'stringio'
4+
5+
class SchemaDumperTest < ActiveRecord::TestCase
6+
7+
COERCED_TESTS = [:test_schema_dump_keeps_large_precision_integer_columns_as_decimal, :test_types_line_up]
8+
9+
include ARTest::SQLServer::CoercedTest
10+
11+
def test_coerced_schema_dump_keeps_large_precision_integer_columns_as_decimal
12+
output = standard_dump
13+
assert_match %r{t.decimal\s+"atoms_in_universe",\s+precision: 38,\s+scale: 0}, output
14+
end
15+
16+
def test_coerced_types_line_up
17+
column_definition_lines.each do |column_set|
18+
next if column_set.empty?
19+
20+
lengths = column_set.map do |column|
21+
if match = column.match(/t\.(?:integer|decimal|float|datetime|timestamp|time|date|text|binary|string|boolean|uuid)\s+"/)
22+
match[0].length
23+
end
24+
end
25+
26+
assert_equal 1, lengths.uniq.length
27+
end
28+
end
29+
30+
end
31+
32+

0 commit comments

Comments
 (0)