arel_extensions 1.3.5 → 2.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +2 -1
  3. data/.gitignore +6 -7
  4. data/.rubocop.yml +3 -67
  5. data/.travis/oracle/download.js +152 -0
  6. data/.travis/oracle/download.sh +30 -0
  7. data/.travis/oracle/download_ojdbc.js +116 -0
  8. data/.travis/oracle/install.sh +34 -0
  9. data/.travis/setup_accounts.sh +9 -0
  10. data/.travis/sqlite3/extension-functions.sh +6 -0
  11. data/.travis.yml +223 -0
  12. data/Gemfile +21 -16
  13. data/README.md +13 -125
  14. data/Rakefile +30 -41
  15. data/TODO +1 -0
  16. data/appveyor.yml +22 -51
  17. data/arel_extensions.gemspec +14 -14
  18. data/functions.html +3 -3
  19. data/gemfiles/rails3.gemfile +10 -10
  20. data/gemfiles/rails4.gemfile +14 -14
  21. data/gemfiles/rails5_0.gemfile +14 -14
  22. data/gemfiles/rails5_1_4.gemfile +14 -14
  23. data/gemfiles/rails5_2.gemfile +14 -16
  24. data/init/mssql.sql +4 -4
  25. data/init/mysql.sql +38 -38
  26. data/init/oracle.sql +0 -0
  27. data/init/postgresql.sql +21 -21
  28. data/init/sqlite.sql +0 -0
  29. data/lib/arel_extensions/attributes.rb +3 -4
  30. data/lib/arel_extensions/boolean_functions.rb +14 -53
  31. data/lib/arel_extensions/common_sql_functions.rb +17 -16
  32. data/lib/arel_extensions/comparators.rb +28 -27
  33. data/lib/arel_extensions/date_duration.rb +14 -13
  34. data/lib/arel_extensions/insert_manager.rb +15 -18
  35. data/lib/arel_extensions/math.rb +53 -55
  36. data/lib/arel_extensions/math_functions.rb +39 -46
  37. data/lib/arel_extensions/nodes/abs.rb +1 -0
  38. data/lib/arel_extensions/nodes/blank.rb +2 -1
  39. data/lib/arel_extensions/nodes/case.rb +16 -16
  40. data/lib/arel_extensions/nodes/cast.rb +8 -10
  41. data/lib/arel_extensions/nodes/ceil.rb +1 -1
  42. data/lib/arel_extensions/nodes/coalesce.rb +4 -3
  43. data/lib/arel_extensions/nodes/collate.rb +10 -9
  44. data/lib/arel_extensions/nodes/concat.rb +18 -9
  45. data/lib/arel_extensions/nodes/date_diff.rb +26 -42
  46. data/lib/arel_extensions/nodes/duration.rb +3 -0
  47. data/lib/arel_extensions/nodes/find_in_set.rb +1 -0
  48. data/lib/arel_extensions/nodes/floor.rb +1 -1
  49. data/lib/arel_extensions/nodes/format.rb +8 -35
  50. data/lib/arel_extensions/nodes/formatted_number.rb +23 -22
  51. data/lib/arel_extensions/nodes/function.rb +37 -42
  52. data/lib/arel_extensions/nodes/is_null.rb +0 -0
  53. data/lib/arel_extensions/nodes/json.rb +39 -48
  54. data/lib/arel_extensions/nodes/length.rb +0 -5
  55. data/lib/arel_extensions/nodes/levenshtein_distance.rb +1 -1
  56. data/lib/arel_extensions/nodes/locate.rb +2 -1
  57. data/lib/arel_extensions/nodes/log10.rb +2 -1
  58. data/lib/arel_extensions/nodes/matches.rb +7 -5
  59. data/lib/arel_extensions/nodes/md5.rb +1 -0
  60. data/lib/arel_extensions/nodes/power.rb +5 -5
  61. data/lib/arel_extensions/nodes/rand.rb +1 -0
  62. data/lib/arel_extensions/nodes/repeat.rb +5 -3
  63. data/lib/arel_extensions/nodes/replace.rb +8 -16
  64. data/lib/arel_extensions/nodes/round.rb +6 -5
  65. data/lib/arel_extensions/nodes/soundex.rb +15 -15
  66. data/lib/arel_extensions/nodes/std.rb +21 -18
  67. data/lib/arel_extensions/nodes/substring.rb +16 -8
  68. data/lib/arel_extensions/nodes/then.rb +1 -1
  69. data/lib/arel_extensions/nodes/trim.rb +6 -4
  70. data/lib/arel_extensions/nodes/union.rb +8 -5
  71. data/lib/arel_extensions/nodes/union_all.rb +7 -4
  72. data/lib/arel_extensions/nodes/wday.rb +4 -0
  73. data/lib/arel_extensions/nodes.rb +1 -1
  74. data/lib/arel_extensions/null_functions.rb +7 -5
  75. data/lib/arel_extensions/predications.rb +43 -44
  76. data/lib/arel_extensions/railtie.rb +5 -5
  77. data/lib/arel_extensions/set_functions.rb +7 -5
  78. data/lib/arel_extensions/string_functions.rb +29 -58
  79. data/lib/arel_extensions/tasks.rb +6 -6
  80. data/lib/arel_extensions/version.rb +1 -1
  81. data/lib/arel_extensions/visitors/ibm_db.rb +31 -24
  82. data/lib/arel_extensions/visitors/mssql.rb +181 -279
  83. data/lib/arel_extensions/visitors/mysql.rb +210 -280
  84. data/lib/arel_extensions/visitors/oracle.rb +180 -201
  85. data/lib/arel_extensions/visitors/oracle12.rb +31 -18
  86. data/lib/arel_extensions/visitors/postgresql.rb +173 -252
  87. data/lib/arel_extensions/visitors/sqlite.rb +126 -140
  88. data/lib/arel_extensions/visitors/to_sql.rb +237 -272
  89. data/lib/arel_extensions/visitors.rb +59 -75
  90. data/lib/arel_extensions.rb +31 -159
  91. data/test/database.yml +7 -15
  92. data/test/helper.rb +18 -0
  93. data/test/real_db_test.rb +116 -105
  94. data/test/support/fake_record.rb +3 -3
  95. data/test/test_comparators.rb +17 -14
  96. data/test/visitors/test_bulk_insert_oracle.rb +11 -11
  97. data/test/visitors/test_bulk_insert_sqlite.rb +13 -12
  98. data/test/visitors/test_bulk_insert_to_sql.rb +13 -11
  99. data/test/visitors/test_oracle.rb +55 -55
  100. data/test/visitors/test_to_sql.rb +226 -419
  101. data/test/with_ar/all_agnostic_test.rb +361 -578
  102. data/test/with_ar/insert_agnostic_test.rb +21 -27
  103. data/test/with_ar/test_bulk_sqlite.rb +16 -17
  104. data/test/with_ar/test_math_sqlite.rb +26 -26
  105. data/test/with_ar/test_string_mysql.rb +33 -31
  106. data/test/with_ar/test_string_sqlite.rb +34 -30
  107. metadata +22 -29
  108. data/.github/workflows/ruby.yml +0 -341
  109. data/gemfiles/rails6.gemfile +0 -30
  110. data/gemfiles/rails6_1.gemfile +0 -30
  111. data/gemfiles/rails7.gemfile +0 -23
  112. data/gemspecs/arel_extensions-v1.gemspec +0 -28
  113. data/gemspecs/arel_extensions-v2.gemspec +0 -28
  114. data/generate_gems.sh +0 -15
  115. data/lib/arel_extensions/aliases.rb +0 -14
  116. data/lib/arel_extensions/helpers.rb +0 -51
  117. data/lib/arel_extensions/nodes/aggregate_function.rb +0 -13
  118. data/lib/arel_extensions/nodes/sum.rb +0 -7
  119. data/lib/arel_extensions/visitors/convert_format.rb +0 -37
  120. data/test/arelx_test_helper.rb +0 -71
  121. data/version_v1.rb +0 -3
  122. data/version_v2.rb +0 -3
@@ -1,97 +1,81 @@
1
- require 'arel_extensions/visitors/convert_format'
2
1
  require 'arel_extensions/visitors/to_sql'
3
2
  require 'arel_extensions/visitors/mysql'
3
+ require 'arel_extensions/visitors/oracle'
4
+ require 'arel_extensions/visitors/oracle12'
4
5
  require 'arel_extensions/visitors/postgresql'
5
6
  require 'arel_extensions/visitors/sqlite'
7
+ require 'arel_extensions/visitors/mssql'
6
8
 
7
- if defined?(Arel::Visitors::Oracle)
8
- require 'arel_extensions/visitors/oracle'
9
- require 'arel_extensions/visitors/oracle12'
10
- end
11
-
12
- if defined?(Arel::Visitors::SQLServer) || defined?(Arel::Visitors::MSSQL)
13
- require 'arel_extensions/visitors/mssql'
14
- end
9
+ Arel::Visitors::MSSQL.class_eval do
10
+ include ArelExtensions::Visitors::MSSQL
15
11
 
16
- if defined?(Arel::Visitors::SQLServer)
17
- class Arel::Visitors::SQLServer
18
- include ArelExtensions::Visitors::MSSQL
12
+ alias_method :old_visit_Arel_Nodes_As, :visit_Arel_Nodes_As
13
+ def visit_Arel_Nodes_As o, collector
14
+ if o.left.is_a?(Arel::Nodes::Binary)
15
+ collector << '('
16
+ collector = visit o.left, collector
17
+ collector << ')'
18
+ else
19
+ collector = visit o.left, collector
20
+ end
21
+ collector << " AS ["
22
+ collector = visit o.right, collector
23
+ collector << "]"
24
+ collector
19
25
  end
20
- end
21
26
 
22
- if defined?(Arel::Visitors::MSSQL)
23
- class Arel::Visitors::MSSQL
24
- include ArelExtensions::Visitors::MSSQL
25
-
26
- alias_method(:old_visit_Arel_Nodes_As, :visit_Arel_Nodes_As) rescue nil
27
- def visit_Arel_Nodes_As o, collector
28
- if o.left.is_a?(Arel::Nodes::Binary)
29
- collector << '('
30
- collector = visit o.left, collector
31
- collector << ')'
32
- else
33
- collector = visit o.left, collector
34
- end
35
- collector << ' AS ['
36
- collector = visit o.right, collector
37
- collector << ']'
38
- collector
39
- end
40
-
41
- alias_method(:old_visit_Arel_Nodes_SelectStatement, :visit_Arel_Nodes_SelectStatement) rescue nil
42
- def visit_Arel_Nodes_SelectStatement o, collector
43
- if !collector.value.blank? && o.limit.blank? && o.offset.blank?
44
- o = o.dup
45
- o.orders = []
46
- end
47
- old_visit_Arel_Nodes_SelectStatement(o, collector)
27
+ alias_method :old_visit_Arel_Nodes_SelectStatement, :visit_Arel_Nodes_SelectStatement
28
+ def visit_Arel_Nodes_SelectStatement o, collector
29
+ if !collector.value.blank? && o.limit.blank? && o.offset.blank?
30
+ o = o.dup
31
+ o.orders = []
48
32
  end
33
+ old_visit_Arel_Nodes_SelectStatement(o,collector)
49
34
  end
35
+ end
50
36
 
51
- begin
52
- require 'arel_sqlserver'
53
- if Arel::VERSION.to_i == 6
54
- if Arel::Visitors::VISITORS['sqlserver'] && Arel::Visitors::VISITORS['sqlserver'] != Arel::Visitors::MSSQL
55
- Arel::Visitors::VISITORS['sqlserver'].class_eval do
56
- include ArelExtensions::Visitors::MSSQL
37
+ begin
38
+ require 'arel_sqlserver'
39
+ if Arel::VERSION.to_i == 6
40
+ if Arel::Visitors::VISITORS['sqlserver'] && Arel::Visitors::VISITORS['sqlserver'] != Arel::Visitors::MSSQL
41
+ Arel::Visitors::VISITORS['sqlserver'].class_eval do
42
+ include ArelExtensions::Visitors::MSSQL
57
43
 
58
- alias_method(:old_visit_Arel_Nodes_SelectStatement, :visit_Arel_Nodes_SelectStatement) rescue nil
59
- def visit_Arel_Nodes_SelectStatement o, collector
60
- if !collector.value.blank? && o.limit.blank? && o.offset.blank?
61
- o = o.dup
62
- o.orders = []
63
- end
64
- old_visit_Arel_Nodes_SelectStatement(o, collector)
44
+ alias_method :old_visit_Arel_Nodes_SelectStatement, :visit_Arel_Nodes_SelectStatement
45
+ def visit_Arel_Nodes_SelectStatement o, collector
46
+ if !collector.value.blank? && o.limit.blank? && o.offset.blank?
47
+ o = o.dup
48
+ o.orders = []
65
49
  end
50
+ old_visit_Arel_Nodes_SelectStatement(o,collector)
51
+ end
66
52
 
67
- alias_method(:old_visit_Arel_Nodes_As, :visit_Arel_Nodes_As) rescue nil
68
- def visit_Arel_Nodes_As o, collector
69
- if o.left.is_a?(Arel::Nodes::Binary)
70
- collector << '('
71
- collector = visit o.left, collector
72
- collector << ')'
73
- else
74
- collector = visit o.left, collector
75
- end
76
- collector << ' AS ['
77
- collector = visit o.right, collector
78
- collector << ']'
79
- collector
53
+ alias_method :old_visit_Arel_Nodes_As, :visit_Arel_Nodes_As
54
+ def visit_Arel_Nodes_As o, collector
55
+ if o.left.is_a?(Arel::Nodes::Binary)
56
+ collector << '('
57
+ collector = visit o.left, collector
58
+ collector << ')'
59
+ else
60
+ collector = visit o.left, collector
80
61
  end
62
+ collector << " AS ["
63
+ collector = visit o.right, collector
64
+ collector << "]"
65
+ collector
66
+ end
81
67
 
82
- alias_method(:old_primary_Key_From_Table, :primary_Key_From_Table) rescue nil
83
- def primary_Key_From_Table t
84
- return unless t
85
-
86
- column_name = @connection.schema_cache.primary_keys(t.name) ||
87
- @connection.schema_cache.columns_hash(t.name).first.try(:second).try(:name)
88
- column_name ? t[column_name] : nil
89
- end
68
+ alias_method :old_primary_Key_From_Table, :primary_Key_From_Table
69
+ def primary_Key_From_Table t
70
+ return unless t
71
+ column_name = @connection.schema_cache.primary_keys(t.name) ||
72
+ @connection.schema_cache.columns_hash(t.name).first.try(:second).try(:name)
73
+ column_name ? t[column_name] : nil
90
74
  end
91
75
  end
92
76
  end
77
+ end
93
78
  rescue LoadError
94
- rescue => e
79
+ rescue => e
95
80
  e
96
- end
97
81
  end
@@ -1,5 +1,4 @@
1
1
  require 'arel'
2
- require 'base64'
3
2
 
4
3
  require 'arel_extensions/railtie' if defined?(Rails::Railtie)
5
4
 
@@ -8,53 +7,41 @@ require 'arel_extensions/railtie' if defined?(Rails::Railtie)
8
7
  # Count|NamedFunction < Function < Arel::Nodes::Node
9
8
 
10
9
  # pure Arel internals improvements
11
- class Arel::Nodes::Binary
10
+ Arel::Nodes::Binary.class_eval do
12
11
  include Arel::AliasPredication
13
12
  include Arel::Expressions
14
13
  end
15
14
 
16
- class Arel::Nodes::Casted
15
+ Arel::Nodes::Casted.class_eval do
17
16
  include Arel::AliasPredication
18
-
19
- # They forget to define hash.
20
- if Gem::Version.new(Arel::VERSION) < Gem::Version.new('10.0.0')
21
- def hash
22
- [self.class, self.val, self.attribute].hash
23
- end
24
- end
25
17
  end
26
18
 
27
- class Arel::Nodes::Unary
19
+ Arel::Nodes::Unary.class_eval do
28
20
  include Arel::Math
29
21
  include Arel::AliasPredication
30
22
  include Arel::Expressions
31
23
  end
32
24
 
33
- class Arel::Nodes::Grouping
25
+ Arel::Nodes::Grouping.class_eval do
26
+ include Arel::Math
27
+ include Arel::AliasPredication
34
28
  include Arel::OrderPredications
29
+ include Arel::Expressions
35
30
  end
36
31
 
37
- class Arel::Nodes::Ordering
38
- def eql? other
39
- self.hash.eql? other.hash
40
- end
41
- end
42
-
43
- class Arel::Nodes::Function
32
+ Arel::Nodes::Function.class_eval do
44
33
  include Arel::Math
45
34
  include Arel::Expressions
46
35
  end
47
36
 
48
- if Gem::Version.new(Arel::VERSION) >= Gem::Version.new('7.1.0')
49
- class Arel::Nodes::Case
37
+ if Arel::VERSION >= "7.1.0"
38
+ Arel::Nodes::Case.class_eval do
50
39
  include Arel::Math
51
40
  include Arel::Expressions
52
41
  end
53
42
  end
54
43
 
55
- require 'arel_extensions/helpers'
56
44
  require 'arel_extensions/version'
57
- require 'arel_extensions/aliases'
58
45
  require 'arel_extensions/attributes'
59
46
  require 'arel_extensions/visitors'
60
47
  require 'arel_extensions/nodes'
@@ -79,55 +66,9 @@ require 'arel_extensions/nodes/soundex'
79
66
  require 'arel_extensions/nodes/cast'
80
67
  require 'arel_extensions/nodes/json'
81
68
 
82
- # It seems like the code in lib/arel_extensions/visitors.rb that is supposed
83
- # to inject ArelExtension is not enough. Different versions of the sqlserver
84
- # adapter behave differently. It doesn't always proc, so we added this for
85
- # coverage.
86
- if defined?(Arel::Visitors::SQLServer)
87
- Arel::Visitors.const_set('MSSQL', Arel::Visitors::SQLServer)
88
- require 'arel_extensions/visitors/mssql'
89
- class Arel::Visitors::SQLServer
90
- include ArelExtensions::Visitors::MSSQL
91
- end
92
- end
93
-
94
- module Arel
95
- def self.column_of table_name, column_name
96
- ArelExtensions.column_of(table_name, column_name)
97
- end
98
69
 
99
- def self.duration s, expr
100
- ArelExtensions::Nodes::Duration.new("#{s}i", expr)
101
- end
102
-
103
- # The FALSE pseudo literal.
104
- def self.false
105
- Arel::Nodes::Equality.new(1, 0)
106
- end
107
-
108
- def self.grouping *v
109
- Arel::Nodes::Grouping.new(*v)
110
- end
111
-
112
- def self.json *expr
113
- ArelExtensions::Nodes::Json.new(
114
- if expr.length == 1
115
- expr.first
116
- else
117
- expr
118
- end
119
- )
120
- end
121
-
122
- # The NULL literal.
123
- def self.null
124
- Arel.quoted(nil)
125
- end
126
-
127
- def self.quoted *args
128
- Arel::Nodes.build_quoted(*args)
129
- end
130
70
 
71
+ module Arel
131
72
  def self.rand
132
73
  ArelExtensions::Nodes::Rand.new
133
74
  end
@@ -136,33 +77,30 @@ module Arel
136
77
  Base64.urlsafe_encode64(Digest::MD5.new.digest(s)).tr('=', '').tr('-', '_')
137
78
  end
138
79
 
139
- # The TRUE pseudo literal.
140
- def self.true
141
- Arel::Nodes::Equality.new(1, 1)
142
- end
143
-
144
- def self.tuple *v
145
- tmp = Arel.grouping(nil)
146
- Arel.grouping v.map{|e| tmp.convert_to_node(e)}
80
+ def self.json *expr
81
+ if expr.length == 1
82
+ ArelExtensions::Nodes::Json.new(expr.first)
83
+ else
84
+ ArelExtensions::Nodes::Json.new(expr)
85
+ end
147
86
  end
148
87
 
149
- # For instance
150
- #
151
- # ```
152
- # Arel.when(at[field].is_null).then(0).else(1)
153
- # ```
154
88
  def self.when condition
155
89
  ArelExtensions::Nodes::Case.new.when(condition)
156
90
  end
91
+
92
+ def self.duration s, expr
93
+ ArelExtensions::Nodes::Duration.new(s.to_s+'i',expr)
94
+ end
95
+
157
96
  end
158
97
 
159
- class Arel::Attributes::Attribute
98
+ Arel::Attributes::Attribute.class_eval do
160
99
  include Arel::Math
161
100
  include ArelExtensions::Attributes
162
101
  end
163
102
 
164
- class Arel::Nodes::Function
165
- include ArelExtensions::Aliases
103
+ Arel::Nodes::Function.class_eval do
166
104
  include ArelExtensions::Math
167
105
  include ArelExtensions::Comparators
168
106
  include ArelExtensions::DateDuration
@@ -171,110 +109,44 @@ class Arel::Nodes::Function
171
109
  include ArelExtensions::BooleanFunctions
172
110
  include ArelExtensions::NullFunctions
173
111
  include ArelExtensions::Predications
174
-
175
- alias_method(:old_as, :as) rescue nil
176
- def as other
177
- res = Arel::Nodes::As.new(self.clone, Arel.sql(other))
178
- if Gem::Version.new(Arel::VERSION) >= Gem::Version.new('9.0.0')
179
- self.alias = Arel.sql(other)
180
- end
181
- res
182
- end
183
- end
184
-
185
- class Arel::Nodes::Grouping
186
- include ArelExtensions::Math
187
- include ArelExtensions::Comparators
188
- include ArelExtensions::DateDuration
189
- include ArelExtensions::MathFunctions
190
- include ArelExtensions::NullFunctions
191
- include ArelExtensions::StringFunctions
192
- include ArelExtensions::Predications
193
112
  end
194
113
 
195
- class Arel::Nodes::Unary
114
+ Arel::Nodes::Unary.class_eval do
196
115
  include ArelExtensions::Math
197
116
  include ArelExtensions::Attributes
198
117
  include ArelExtensions::MathFunctions
199
118
  include ArelExtensions::Comparators
200
119
  include ArelExtensions::Predications
201
- def eql? other
202
- hash == other.hash
203
- end
204
120
  end
205
121
 
206
- class Arel::Nodes::Binary
122
+ Arel::Nodes::Binary.class_eval do
207
123
  include ArelExtensions::Math
208
124
  include ArelExtensions::Attributes
209
125
  include ArelExtensions::MathFunctions
210
126
  include ArelExtensions::Comparators
211
127
  include ArelExtensions::BooleanFunctions
212
128
  include ArelExtensions::Predications
213
- def eql? other
214
- hash == other.hash
215
- end
216
129
  end
217
130
 
218
- class Arel::Nodes::Equality
131
+ Arel::Nodes::Equality.class_eval do
219
132
  include ArelExtensions::Comparators
220
133
  include ArelExtensions::DateDuration
221
134
  include ArelExtensions::MathFunctions
222
135
  include ArelExtensions::StringFunctions
223
136
  end
224
137
 
225
- class Arel::InsertManager
138
+
139
+ Arel::InsertManager.class_eval do
226
140
  include ArelExtensions::InsertManager
227
141
  end
228
142
 
229
- class Arel::SelectManager
143
+ Arel::SelectManager.class_eval do
230
144
  include ArelExtensions::SetFunctions
231
145
  include ArelExtensions::Nodes
232
-
233
- def as table_name
234
- Arel::Nodes::TableAlias.new(self, table_name)
235
- end
236
-
237
- # Install an alias, if present.
238
- def xas table_name
239
- if table_name.present?
240
- as table_name
241
- else
242
- self
243
- end
244
- end
245
146
  end
246
147
 
247
- class Arel::Nodes::As
148
+ Arel::Nodes::As.class_eval do
248
149
  include ArelExtensions::Nodes
249
150
  end
250
151
 
251
- class Arel::Table
252
- alias_method(:old_alias, :alias) rescue nil
253
- def alias(name = "#{self.name}_2")
254
- if name.present?
255
- Arel::Nodes::TableAlias.new(self, name)
256
- else
257
- self
258
- end
259
- end
260
- end
261
152
 
262
- class Arel::Nodes::TableAlias
263
- def method_missing(*args)
264
- met = args.shift.to_sym
265
- if self.relation.respond_to?(met)
266
- self.relation.send(met, args)
267
- else
268
- super(met, *args)
269
- end
270
- end
271
- end
272
-
273
-
274
- class Arel::Attributes::Attribute
275
- def to_sql(engine = Arel::Table.engine)
276
- collector = Arel::Collectors::SQLString.new
277
- collector = engine.connection.visitor.accept self, collector
278
- collector.value
279
- end
280
- end
data/test/database.yml CHANGED
@@ -8,30 +8,22 @@ jdbc-sqlite:
8
8
  timeout: 500
9
9
  mysql:
10
10
  adapter: mysql2
11
- database: arelx_test
12
- username: root
13
- host: 127.0.0.1
14
- port: 3306
11
+ database: arext_test
12
+ username: travis
15
13
  encoding: utf8
16
14
  jdbc-mysql:
17
15
  adapter: jdbcmysql
18
- database: arelx_test
19
- username: root
16
+ database: arext_test
17
+ username: travis
20
18
  encoding: utf8
21
19
  postgresql:
22
20
  adapter: postgresql
23
- database: arelx_test
21
+ database: arext_test
24
22
  username: postgres
25
- password: secret
26
- host: 127.0.0.1
27
- port: 5432
28
23
  jdbc-postgresql:
29
24
  adapter: jdbcpostgresql
30
- database: arelx_test
25
+ database: arext_test
31
26
  username: postgres
32
- password: secret
33
- host: 127.0.0.1
34
- port: 5432
35
27
  oracle:
36
28
  adapter: oracle_enhanced
37
29
  database: xe
@@ -45,7 +37,7 @@ jdbc-oracle:
45
37
  ibm_db:
46
38
  adapter: ibm_db
47
39
  username: travis
48
- database: arelx_test
40
+ database: arext_test
49
41
  mssql:
50
42
  adapter: sqlserver
51
43
  host: localhost
data/test/helper.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'minitest/autorun'
3
+ require 'fileutils'
4
+ require 'arel'
5
+ require 'active_record'
6
+
7
+ require 'arel_extensions'
8
+
9
+ require 'support/fake_record'
10
+ Arel::Table.engine = FakeRecord::Base.new
11
+
12
+ $arel_silence_type_casting_deprecation = true
13
+
14
+ class Object
15
+ def must_be_like other
16
+ gsub(/\s+/, ' ').strip.must_equal other.gsub(/\s+/, ' ').strip
17
+ end
18
+ end