Skip to content

Commit 679c340

Browse files
committed
Cleanup
1 parent b42579b commit 679c340

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

test/cases/helper_sqlserver.rb

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,7 @@
77
require "support/core_ext/query_cache"
88
require "support/minitest_sqlserver"
99
require "support/test_in_memory_oltp"
10-
11-
1210
require "support/table_definition_sqlserver"
13-
module ActiveRecord
14-
module ConnectionAdapters
15-
module SQLServer
16-
class TableDefinition < ::ActiveRecord::ConnectionAdapters::TableDefinition
17-
include ARTest::SQLServer::TableDefinition
18-
end
19-
end
20-
end
21-
end
22-
2311
require "cases/helper"
2412
require "support/load_schema_sqlserver"
2513
require "support/coerceable_test_sqlserver"

test/support/table_definition_sqlserver.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# frozen_string_literal: true
22

3-
module ARTest
4-
module SQLServer
5-
module TableDefinition
6-
extend ActiveSupport::Concern
7-
8-
included do
3+
module ActiveRecord
4+
module ConnectionAdapters
5+
module SQLServer
6+
class TableDefinition < ::ActiveRecord::ConnectionAdapters::TableDefinition
97
# SQL Server supports precision of 38 for decimal columns. In Rails the test schema includes a column
108
# with a precision of 55. This is a problem for SQL Server 2008. This method will override the default
119
# decimal method to limit the precision to 38 for the :atoms_in_universe column.
1210
# See https://github.com/rails/rails/pull/51826/files#diff-2a57b61bbf9ee2c23938fc571d403799f68b4b530d65e2cde219a429bbf10af5L876
1311
def decimal(*names, **options)
12+
throw "This 'decimal' method should only be used in a test environment." unless defined?(ActiveSupport::TestCase)
13+
1414
names.each do |name|
1515
options_for_name = options.dup
1616
options_for_name[:precision] = 38 if name == :atoms_in_universe && options_for_name[:precision].to_i == 55

0 commit comments

Comments
 (0)