arel_extensions 1.3.4 → 2.0.0.rc3

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