activerecord-sqlserver-adapter 6.0.0.rc1 → 6.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +29 -0
  4. data/CHANGELOG.md +20 -0
  5. data/Gemfile +11 -5
  6. data/Guardfile +9 -8
  7. data/Rakefile +12 -16
  8. data/VERSION +1 -1
  9. data/activerecord-sqlserver-adapter.gemspec +3 -3
  10. data/lib/active_record/connection_adapters/sqlserver/core_ext/active_record.rb +0 -4
  11. data/lib/active_record/connection_adapters/sqlserver/core_ext/attribute_methods.rb +1 -4
  12. data/lib/active_record/connection_adapters/sqlserver/core_ext/calculations.rb +3 -4
  13. data/lib/active_record/connection_adapters/sqlserver/core_ext/explain.rb +1 -3
  14. data/lib/active_record/connection_adapters/sqlserver/core_ext/finder_methods.rb +2 -3
  15. data/lib/active_record/connection_adapters/sqlserver/core_ext/query_methods.rb +2 -3
  16. data/lib/active_record/connection_adapters/sqlserver/database_statements.rb +35 -32
  17. data/lib/active_record/connection_adapters/sqlserver/database_tasks.rb +7 -12
  18. data/lib/active_record/connection_adapters/sqlserver/errors.rb +0 -3
  19. data/lib/active_record/connection_adapters/sqlserver/quoting.rb +8 -8
  20. data/lib/active_record/connection_adapters/sqlserver/schema_creation.rb +0 -2
  21. data/lib/active_record/connection_adapters/sqlserver/schema_dumper.rb +7 -7
  22. data/lib/active_record/connection_adapters/sqlserver/schema_statements.rb +106 -103
  23. data/lib/active_record/connection_adapters/sqlserver/showplan.rb +6 -8
  24. data/lib/active_record/connection_adapters/sqlserver/showplan/printer_table.rb +2 -2
  25. data/lib/active_record/connection_adapters/sqlserver/showplan/printer_xml.rb +1 -1
  26. data/lib/active_record/connection_adapters/sqlserver/sql_type_metadata.rb +0 -2
  27. data/lib/active_record/connection_adapters/sqlserver/table_definition.rb +1 -4
  28. data/lib/active_record/connection_adapters/sqlserver/transaction.rb +4 -8
  29. data/lib/active_record/connection_adapters/sqlserver/type.rb +35 -35
  30. data/lib/active_record/connection_adapters/sqlserver/type/big_integer.rb +0 -2
  31. data/lib/active_record/connection_adapters/sqlserver/type/binary.rb +0 -2
  32. data/lib/active_record/connection_adapters/sqlserver/type/boolean.rb +0 -2
  33. data/lib/active_record/connection_adapters/sqlserver/type/char.rb +2 -2
  34. data/lib/active_record/connection_adapters/sqlserver/type/data.rb +0 -2
  35. data/lib/active_record/connection_adapters/sqlserver/type/date.rb +2 -3
  36. data/lib/active_record/connection_adapters/sqlserver/type/datetime.rb +2 -3
  37. data/lib/active_record/connection_adapters/sqlserver/type/datetime2.rb +0 -2
  38. data/lib/active_record/connection_adapters/sqlserver/type/datetimeoffset.rb +0 -2
  39. data/lib/active_record/connection_adapters/sqlserver/type/decimal.rb +0 -2
  40. data/lib/active_record/connection_adapters/sqlserver/type/float.rb +0 -2
  41. data/lib/active_record/connection_adapters/sqlserver/type/integer.rb +0 -2
  42. data/lib/active_record/connection_adapters/sqlserver/type/json.rb +0 -1
  43. data/lib/active_record/connection_adapters/sqlserver/type/money.rb +0 -2
  44. data/lib/active_record/connection_adapters/sqlserver/type/real.rb +0 -2
  45. data/lib/active_record/connection_adapters/sqlserver/type/small_integer.rb +0 -2
  46. data/lib/active_record/connection_adapters/sqlserver/type/small_money.rb +0 -2
  47. data/lib/active_record/connection_adapters/sqlserver/type/smalldatetime.rb +0 -2
  48. data/lib/active_record/connection_adapters/sqlserver/type/string.rb +0 -2
  49. data/lib/active_record/connection_adapters/sqlserver/type/text.rb +0 -2
  50. data/lib/active_record/connection_adapters/sqlserver/type/time.rb +2 -3
  51. data/lib/active_record/connection_adapters/sqlserver/type/time_value_fractional.rb +6 -9
  52. data/lib/active_record/connection_adapters/sqlserver/type/timestamp.rb +0 -2
  53. data/lib/active_record/connection_adapters/sqlserver/type/tiny_integer.rb +0 -2
  54. data/lib/active_record/connection_adapters/sqlserver/type/unicode_char.rb +1 -3
  55. data/lib/active_record/connection_adapters/sqlserver/type/unicode_string.rb +0 -2
  56. data/lib/active_record/connection_adapters/sqlserver/type/unicode_text.rb +0 -2
  57. data/lib/active_record/connection_adapters/sqlserver/type/unicode_varchar.rb +0 -2
  58. data/lib/active_record/connection_adapters/sqlserver/type/unicode_varchar_max.rb +0 -2
  59. data/lib/active_record/connection_adapters/sqlserver/type/uuid.rb +1 -2
  60. data/lib/active_record/connection_adapters/sqlserver/type/varbinary.rb +1 -3
  61. data/lib/active_record/connection_adapters/sqlserver/type/varbinary_max.rb +0 -2
  62. data/lib/active_record/connection_adapters/sqlserver/type/varchar.rb +1 -3
  63. data/lib/active_record/connection_adapters/sqlserver/type/varchar_max.rb +0 -2
  64. data/lib/active_record/connection_adapters/sqlserver/utils.rb +8 -11
  65. data/lib/active_record/connection_adapters/sqlserver/version.rb +0 -2
  66. data/lib/active_record/connection_adapters/sqlserver_adapter.rb +85 -83
  67. data/lib/active_record/connection_adapters/sqlserver_column.rb +0 -2
  68. data/lib/active_record/sqlserver_base.rb +1 -1
  69. data/lib/active_record/tasks/sqlserver_database_tasks.rb +26 -32
  70. data/lib/activerecord-sqlserver-adapter.rb +1 -1
  71. data/lib/arel/visitors/sqlserver.rb +18 -14
  72. data/lib/arel_sqlserver.rb +2 -2
  73. data/test/cases/adapter_test_sqlserver.rb +161 -182
  74. data/test/cases/change_column_null_test_sqlserver.rb +12 -12
  75. data/test/cases/coerced_tests.rb +88 -270
  76. data/test/cases/column_test_sqlserver.rb +281 -283
  77. data/test/cases/connection_test_sqlserver.rb +15 -20
  78. data/test/cases/execute_procedure_test_sqlserver.rb +18 -20
  79. data/test/cases/fetch_test_sqlserver.rb +14 -22
  80. data/test/cases/fully_qualified_identifier_test_sqlserver.rb +12 -18
  81. data/test/cases/helper_sqlserver.rb +13 -15
  82. data/test/cases/in_clause_test_sqlserver.rb +9 -9
  83. data/test/cases/index_test_sqlserver.rb +13 -15
  84. data/test/cases/json_test_sqlserver.rb +23 -25
  85. data/test/cases/migration_test_sqlserver.rb +22 -28
  86. data/test/cases/order_test_sqlserver.rb +51 -54
  87. data/test/cases/pessimistic_locking_test_sqlserver.rb +25 -33
  88. data/test/cases/rake_test_sqlserver.rb +31 -45
  89. data/test/cases/schema_dumper_test_sqlserver.rb +104 -108
  90. data/test/cases/schema_test_sqlserver.rb +18 -26
  91. data/test/cases/scratchpad_test_sqlserver.rb +2 -4
  92. data/test/cases/showplan_test_sqlserver.rb +24 -33
  93. data/test/cases/specific_schema_test_sqlserver.rb +66 -65
  94. data/test/cases/transaction_test_sqlserver.rb +16 -19
  95. data/test/cases/trigger_test_sqlserver.rb +12 -12
  96. data/test/cases/utils_test_sqlserver.rb +68 -70
  97. data/test/cases/uuid_test_sqlserver.rb +11 -13
  98. data/test/debug.rb +6 -6
  99. data/test/migrations/create_clients_and_change_column_null.rb +1 -1
  100. data/test/migrations/transaction_table/1_table_will_never_be_created.rb +2 -4
  101. data/test/models/sqlserver/booking.rb +1 -1
  102. data/test/models/sqlserver/customers_view.rb +1 -1
  103. data/test/models/sqlserver/dollar_table_name.rb +1 -1
  104. data/test/models/sqlserver/edge_schema.rb +1 -3
  105. data/test/models/sqlserver/fk_has_fk.rb +1 -1
  106. data/test/models/sqlserver/fk_has_pk.rb +1 -1
  107. data/test/models/sqlserver/natural_pk_data.rb +2 -2
  108. data/test/models/sqlserver/natural_pk_int_data.rb +1 -1
  109. data/test/models/sqlserver/no_pk_data.rb +1 -1
  110. data/test/models/sqlserver/object_default.rb +1 -1
  111. data/test/models/sqlserver/quoted_table.rb +2 -2
  112. data/test/models/sqlserver/quoted_view_1.rb +1 -1
  113. data/test/models/sqlserver/quoted_view_2.rb +1 -1
  114. data/test/models/sqlserver/sst_memory.rb +1 -1
  115. data/test/models/sqlserver/string_default.rb +1 -1
  116. data/test/models/sqlserver/string_defaults_big_view.rb +1 -1
  117. data/test/models/sqlserver/string_defaults_view.rb +1 -1
  118. data/test/models/sqlserver/tinyint_pk.rb +1 -1
  119. data/test/models/sqlserver/trigger.rb +2 -2
  120. data/test/models/sqlserver/trigger_history.rb +1 -1
  121. data/test/models/sqlserver/upper.rb +1 -1
  122. data/test/models/sqlserver/uppered.rb +1 -1
  123. data/test/models/sqlserver/uuid.rb +1 -1
  124. data/test/schema/sqlserver_specific_schema.rb +20 -22
  125. data/test/support/coerceable_test_sqlserver.rb +1 -4
  126. data/test/support/connection_reflection.rb +1 -2
  127. data/test/support/core_ext/query_cache.rb +1 -1
  128. data/test/support/load_schema_sqlserver.rb +3 -5
  129. data/test/support/minitest_sqlserver.rb +1 -1
  130. data/test/support/paths_sqlserver.rb +9 -11
  131. data/test/support/rake_helpers.rb +12 -10
  132. data/test/support/sql_counter_sqlserver.rb +0 -4
  133. data/test/support/test_in_memory_oltp.rb +7 -7
  134. metadata +5 -4
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTestQuotedView2 < ActiveRecord::Base
4
- self.table_name = 'sst_quoted-view2'
4
+ self.table_name = "sst_quoted-view2"
5
5
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTMemory < ActiveRecord::Base
4
- self.table_name = 'sst_memory'
4
+ self.table_name = "sst_memory"
5
5
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTestStringDefault < ActiveRecord::Base
4
- self.table_name = 'sst_string_defaults'
4
+ self.table_name = "sst_string_defaults"
5
5
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTestStringDefaultsBigView < ActiveRecord::Base
4
- self.table_name = 'sst_string_defaults_big_view'
4
+ self.table_name = "sst_string_defaults_big_view"
5
5
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTestStringDefaultsView < ActiveRecord::Base
4
- self.table_name = 'sst_string_defaults_view'
4
+ self.table_name = "sst_string_defaults_view"
5
5
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTestTinyintPk < ActiveRecord::Base
4
- self.table_name = 'sst_tinyint_pk'
4
+ self.table_name = "sst_tinyint_pk"
5
5
  end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTestTrigger < ActiveRecord::Base
4
- self.table_name = 'sst_table_with_trigger'
4
+ self.table_name = "sst_table_with_trigger"
5
5
  end
6
6
 
7
7
  class SSTestTriggerUuid < ActiveRecord::Base
8
- self.table_name = 'sst_table_with_uuid_trigger'
8
+ self.table_name = "sst_table_with_uuid_trigger"
9
9
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTestTriggerHistory < ActiveRecord::Base
4
- self.table_name = 'sst_table_with_trigger_history'
4
+ self.table_name = "sst_table_with_trigger_history"
5
5
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTestUpper < ActiveRecord::Base
4
- self.table_name = 'sst_upper_tests'
4
+ self.table_name = "sst_upper_tests"
5
5
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTestUppered < ActiveRecord::Base
4
- self.table_name = 'SST_UPPER_TESTS'
4
+ self.table_name = "SST_UPPER_TESTS"
5
5
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTestUuid < ActiveRecord::Base
4
- self.table_name = 'sst_uuids'
4
+ self.table_name = "sst_uuids"
5
5
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  ActiveRecord::Schema.define do
4
-
5
4
  # Exhaustive Data Types
6
5
 
7
6
  execute File.read(ARTest::SQLServer.schema_datatypes_2012_file)
@@ -45,28 +44,28 @@ ActiveRecord::Schema.define do
45
44
 
46
45
  # Edge Cases
47
46
 
48
- if ENV['IN_MEMORY_OLTP'] && supports_in_memory_oltp?
49
- create_table 'sst_memory', force: true, id: false,
50
- options: 'WITH (MEMORY_OPTIMIZED = ON, DURABILITY = SCHEMA_AND_DATA)' do |t|
47
+ if ENV["IN_MEMORY_OLTP"] && supports_in_memory_oltp?
48
+ create_table "sst_memory", force: true, id: false,
49
+ options: "WITH (MEMORY_OPTIMIZED = ON, DURABILITY = SCHEMA_AND_DATA)" do |t|
51
50
  t.primary_key_nonclustered :id
52
51
  t.string :name
53
52
  t.timestamps
54
53
  end
55
54
  end
56
55
 
57
- create_table 'sst_bookings', force: true do |t|
56
+ create_table "sst_bookings", force: true do |t|
58
57
  t.string :name
59
58
  t.datetime2 :created_at, null: false
60
59
  t.datetime2 :updated_at, null: false
61
60
  end
62
61
 
63
- create_table 'sst_uuids', force: true, id: :uuid do |t|
62
+ create_table "sst_uuids", force: true, id: :uuid do |t|
64
63
  t.string :name
65
- t.uuid :other_uuid, default: 'NEWID()'
64
+ t.uuid :other_uuid, default: "NEWID()"
66
65
  t.uuid :uuid_nil_default, default: nil
67
66
  end
68
67
 
69
- create_table 'sst_my$strange_table', force: true do |t|
68
+ create_table "sst_my$strange_table", force: true do |t|
70
69
  t.string :name
71
70
  end
72
71
 
@@ -79,27 +78,27 @@ ActiveRecord::Schema.define do
79
78
  t.string :name
80
79
  end
81
80
 
82
- create_table 'sst_quoted-table', force: true do |t|
81
+ create_table "sst_quoted-table", force: true do |t|
83
82
  end
84
83
  execute "IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'sst_quoted-view1') DROP VIEW [sst_quoted-view1]"
85
84
  execute "CREATE VIEW [sst_quoted-view1] AS SELECT * FROM [sst_quoted-table]"
86
85
  execute "IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'sst_quoted-view2') DROP VIEW [sst_quoted-view2]"
87
- execute "CREATE VIEW [sst_quoted-view2] AS \n /*#{'x'*4000}}*/ \n SELECT * FROM [sst_quoted-table]"
86
+ execute "CREATE VIEW [sst_quoted-view2] AS \n /*#{'x' * 4000}}*/ \n SELECT * FROM [sst_quoted-table]"
88
87
 
89
88
  create_table :sst_string_defaults, force: true do |t|
90
89
  t.column :string_with_null_default, :string, default: nil
91
- t.column :string_with_pretend_null_one, :string, default: 'null'
92
- t.column :string_with_pretend_null_two, :string, default: '(null)'
93
- t.column :string_with_pretend_null_three, :string, default: 'NULL'
94
- t.column :string_with_pretend_null_four, :string, default: '(NULL)'
95
- t.column :string_with_pretend_paren_three, :string, default: '(3)'
90
+ t.column :string_with_pretend_null_one, :string, default: "null"
91
+ t.column :string_with_pretend_null_two, :string, default: "(null)"
92
+ t.column :string_with_pretend_null_three, :string, default: "NULL"
93
+ t.column :string_with_pretend_null_four, :string, default: "(NULL)"
94
+ t.column :string_with_pretend_paren_three, :string, default: "(3)"
96
95
  t.column :string_with_multiline_default, :string, default: "Some long default with a\nnew line."
97
96
  end
98
97
 
99
98
  create_table :sst_edge_schemas, force: true do |t|
100
99
  t.string :description
101
- t.column 'crazy]]quote', :string
102
- t.column 'with spaces', :string
100
+ t.column "crazy]]quote", :string
101
+ t.column "with spaces", :string
103
102
  end
104
103
 
105
104
  execute "IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'sst_natural_pk_data') DROP TABLE sst_natural_pk_data"
@@ -132,7 +131,7 @@ ActiveRecord::Schema.define do
132
131
 
133
132
  execute "DROP DEFAULT [sst_getdateobject];" rescue nil
134
133
  execute "CREATE DEFAULT [sst_getdateobject] AS getdate();" rescue nil
135
- create_table 'sst_defaultobjects', force: true do |t|
134
+ create_table "sst_defaultobjects", force: true do |t|
136
135
  t.string :name
137
136
  t.date :date
138
137
  end
@@ -151,7 +150,7 @@ ActiveRecord::Schema.define do
151
150
  t.column(:fk_id2, :bigint)
152
151
  end
153
152
 
154
- create_table(:sst_has_pks, force: true) { }
153
+ create_table(:sst_has_pks, force: true) {}
155
154
  execute <<-ADDFKSQL
156
155
  ALTER TABLE sst_has_fks
157
156
  ADD CONSTRAINT FK__sst_has_fks_id
@@ -183,7 +182,7 @@ ActiveRecord::Schema.define do
183
182
  execute <<-STRINGDEFAULTSBIGVIEW
184
183
  CREATE VIEW sst_string_defaults_big_view AS
185
184
  SELECT id, string_with_pretend_null_one as pretend_null
186
- /*#{'x'*4000}}*/
185
+ /*#{'x' * 4000}}*/
187
186
  FROM sst_string_defaults
188
187
  STRINGDEFAULTSBIGVIEW
189
188
 
@@ -228,7 +227,7 @@ ActiveRecord::Schema.define do
228
227
  # Another schema.
229
228
 
230
229
  create_table :sst_schema_columns, force: true do |t|
231
- t.column :field1 , :integer
230
+ t.column :field1, :integer
232
231
  end
233
232
 
234
233
  execute "IF NOT EXISTS(SELECT * FROM sys.schemas WHERE name = 'test') EXEC sp_executesql N'CREATE SCHEMA test'"
@@ -278,5 +277,4 @@ ActiveRecord::Schema.define do
278
277
  field_2 int NOT NULL PRIMARY KEY,
279
278
  )
280
279
  SCHEMATESTMULTIPLESCHEMA
281
-
282
280
  end
@@ -3,7 +3,6 @@
3
3
  module ARTest
4
4
  module SQLServer
5
5
  module CoerceableTest
6
-
7
6
  extend ActiveSupport::Concern
8
7
 
9
8
  included do
@@ -12,7 +11,6 @@ module ARTest
12
11
  end
13
12
 
14
13
  module ClassMethods
15
-
16
14
  def coerce_tests!(*methods)
17
15
  methods.each do |method|
18
16
  self.coerced_tests.push(method)
@@ -23,6 +21,7 @@ module ARTest
23
21
  def coerce_all_tests!
24
22
  instance_methods(false).each do |method|
25
23
  next unless method.to_s =~ /\Atest/
24
+
26
25
  undef_method(method)
27
26
  end
28
27
  STDOUT.puts "🙉 🙈 🙊 Undefined all tests: #{self.name}"
@@ -50,9 +49,7 @@ module ARTest
50
49
  end
51
50
  end
52
51
  end
53
-
54
52
  end
55
-
56
53
  end
57
54
  end
58
55
  end
@@ -3,7 +3,6 @@
3
3
  module ARTest
4
4
  module SQLServer
5
5
  module ConnectionReflection
6
-
7
6
  extend ActiveSupport::Concern
8
7
 
9
8
  included { extend ConnectionReflection }
@@ -22,6 +21,7 @@ module ARTest
22
21
 
23
22
  def connection_dblib_73?
24
23
  return false unless connection_dblib?
24
+
25
25
  rc = connection.raw_connection
26
26
  rc.respond_to?(:tds_73?) && rc.tds_73?
27
27
  end
@@ -29,7 +29,6 @@ module ARTest
29
29
  def connection_sqlserver_azure?
30
30
  connection.sqlserver_azure?
31
31
  end
32
-
33
32
  end
34
33
  end
35
34
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_record/connection_adapters/sqlserver_adapter'
3
+ require "active_record/connection_adapters/sqlserver_adapter"
4
4
 
5
5
  module SqlIgnoredCache
6
6
  extend ActiveSupport::Concern
@@ -2,19 +2,18 @@
2
2
 
3
3
  module ARTest
4
4
  module SQLServer
5
-
6
5
  extend self
7
6
 
8
7
  def schema_root
9
- File.join ARTest::SQLServer.test_root_sqlserver, 'schema'
8
+ File.join ARTest::SQLServer.test_root_sqlserver, "schema"
10
9
  end
11
10
 
12
11
  def schema_file
13
- File.join schema_root, 'sqlserver_specific_schema.rb'
12
+ File.join schema_root, "sqlserver_specific_schema.rb"
14
13
  end
15
14
 
16
15
  def schema_datatypes_2012_file
17
- File.join schema_root, 'datatypes', '2012.sql'
16
+ File.join schema_root, "datatypes", "2012.sql"
18
17
  end
19
18
 
20
19
  def load_schema
@@ -24,7 +23,6 @@ module ARTest
24
23
  ensure
25
24
  $stdout = original_stdout
26
25
  end
27
-
28
26
  end
29
27
  end
30
28
 
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'minitest-spec-rails/init/active_support'
3
+ require "minitest-spec-rails/init/active_support"
@@ -2,31 +2,30 @@
2
2
 
3
3
  module ARTest
4
4
  module SQLServer
5
-
6
5
  extend self
7
6
 
8
7
  def root_sqlserver
9
- File.expand_path File.join(File.dirname(__FILE__), '..', '..')
8
+ File.expand_path File.join(File.dirname(__FILE__), "..", "..")
10
9
  end
11
10
 
12
11
  def test_root_sqlserver
13
- File.join root_sqlserver, 'test'
12
+ File.join root_sqlserver, "test"
14
13
  end
15
14
 
16
15
  def root_activerecord
17
- File.join Gem.loaded_specs['rails'].full_gem_path, 'activerecord'
16
+ File.join Gem.loaded_specs["rails"].full_gem_path, "activerecord"
18
17
  end
19
18
 
20
19
  def root_activerecord_lib
21
- File.join root_activerecord, 'lib'
20
+ File.join root_activerecord, "lib"
22
21
  end
23
22
 
24
23
  def root_activerecord_test
25
- File.join root_activerecord, 'test'
24
+ File.join root_activerecord, "test"
26
25
  end
27
26
 
28
27
  def test_load_paths
29
- ['lib', 'test', root_activerecord_lib, root_activerecord_test]
28
+ ["lib", "test", root_activerecord_lib, root_activerecord_test]
30
29
  end
31
30
 
32
31
  def add_to_load_paths!
@@ -34,17 +33,16 @@ module ARTest
34
33
  end
35
34
 
36
35
  def migrations_root
37
- File.join test_root_sqlserver, 'migrations'
36
+ File.join test_root_sqlserver, "migrations"
38
37
  end
39
38
 
40
39
  def arconfig_file
41
- File.join test_root_sqlserver, 'config.yml'
40
+ File.join test_root_sqlserver, "config.yml"
42
41
  end
43
42
 
44
43
  def arconfig_file_env!
45
- ENV['ARCONFIG'] = arconfig_file
44
+ ENV["ARCONFIG"] = arconfig_file
46
45
  end
47
-
48
46
  end
49
47
  end
50
48
 
@@ -1,29 +1,31 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- SQLSERVER_HELPER = 'test/cases/helper_sqlserver.rb'
4
- SQLSERVER_COERCED = 'test/cases/coerced_tests.rb'
3
+ SQLSERVER_HELPER = "test/cases/helper_sqlserver.rb"
4
+ SQLSERVER_COERCED = "test/cases/coerced_tests.rb"
5
5
 
6
6
  def env_ar_test_files
7
- return unless ENV['TEST_FILES_AR'] && !ENV['TEST_FILES_AR'].empty?
7
+ return unless ENV["TEST_FILES_AR"] && !ENV["TEST_FILES_AR"].empty?
8
+
8
9
  @env_ar_test_files ||= begin
9
- ENV['TEST_FILES_AR'].split(',').map { |file|
10
+ ENV["TEST_FILES_AR"].split(",").map { |file|
10
11
  File.join ARTest::SQLServer.root_activerecord, file.strip
11
12
  }.sort
12
13
  end
13
14
  end
14
15
 
15
16
  def env_test_files
16
- return unless ENV['TEST_FILES'] && !ENV['TEST_FILES'].empty?
17
- @env_test_files ||= ENV['TEST_FILES'].split(',').map(&:strip)
17
+ return unless ENV["TEST_FILES"] && !ENV["TEST_FILES"].empty?
18
+
19
+ @env_test_files ||= ENV["TEST_FILES"].split(",").map(&:strip)
18
20
  end
19
21
 
20
22
  def sqlserver_cases
21
- @sqlserver_cases ||= Dir.glob('test/cases/*_test_sqlserver.rb')
23
+ @sqlserver_cases ||= Dir.glob("test/cases/*_test_sqlserver.rb")
22
24
  end
23
25
 
24
26
  def ar_cases
25
27
  @ar_cases ||= begin
26
- Dir.glob("#{ARTest::SQLServer.root_activerecord}/test/cases/**/*_test.rb").reject{ |x| x =~ /\/adapters\// }.sort
28
+ Dir.glob("#{ARTest::SQLServer.root_activerecord}/test/cases/**/*_test.rb").reject { |x| x =~ /\/adapters\// }.sort
27
29
  end
28
30
  end
29
31
 
@@ -32,9 +34,9 @@ def test_files
32
34
  [SQLSERVER_HELPER] + env_ar_test_files
33
35
  elsif env_test_files
34
36
  env_test_files
35
- elsif ENV['ONLY_SQLSERVER']
37
+ elsif ENV["ONLY_SQLSERVER"]
36
38
  sqlserver_cases
37
- elsif ENV['ONLY_ACTIVERECORD']
39
+ elsif ENV["ONLY_ACTIVERECORD"]
38
40
  [SQLSERVER_HELPER] + (ar_cases + [SQLSERVER_COERCED])
39
41
  else
40
42
  [SQLSERVER_HELPER] + (ar_cases + [SQLSERVER_COERCED] + sqlserver_cases)
@@ -2,16 +2,13 @@
2
2
 
3
3
  module ARTest
4
4
  module SQLServer
5
-
6
5
  module SqlCounterSqlserver
7
-
8
6
  # Only return the log vs. log_all
9
7
  def capture_sql_ss
10
8
  ActiveRecord::SQLCounter.clear_log
11
9
  yield
12
10
  ActiveRecord::SQLCounter.log.dup
13
11
  end
14
-
15
12
  end
16
13
 
17
14
  ignored_sql = [
@@ -26,6 +23,5 @@ module ARTest
26
23
 
27
24
  sqlcounter = ObjectSpace.each_object(ActiveRecord::SQLCounter).to_a.first
28
25
  sqlcounter.instance_variable_set :@ignore, Regexp.union(ignored_sql.push(sqlcounter.ignore))
29
-
30
26
  end
31
27
  end