arel 0.3.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/arel/algebra.rb +1 -0
- data/lib/arel/algebra/attributes.rb +1 -1
- data/lib/arel/algebra/attributes/attribute.rb +95 -7
- data/lib/arel/algebra/attributes/integer.rb +1 -1
- data/lib/arel/algebra/core_extensions/object.rb +0 -13
- data/lib/arel/algebra/header.rb +67 -0
- data/lib/arel/algebra/predicates.rb +153 -7
- data/lib/arel/algebra/relations/operations/having.rb +11 -7
- data/lib/arel/algebra/relations/operations/join.rb +1 -2
- data/lib/arel/algebra/relations/operations/project.rb +1 -1
- data/lib/arel/algebra/relations/relation.rb +13 -22
- data/lib/arel/algebra/relations/utilities/compound.rb +5 -1
- data/lib/arel/algebra/relations/utilities/externalization.rb +1 -1
- data/lib/arel/engines/memory/predicates.rb +58 -2
- data/lib/arel/engines/memory/relations/array.rb +6 -3
- data/lib/arel/engines/memory/relations/operations.rb +1 -1
- data/lib/arel/engines/sql/attributes.rb +1 -1
- data/lib/arel/engines/sql/core_extensions/array.rb +4 -0
- data/lib/arel/engines/sql/core_extensions/nil_class.rb +4 -0
- data/lib/arel/engines/sql/core_extensions/object.rb +4 -0
- data/lib/arel/engines/sql/core_extensions/range.rb +4 -0
- data/lib/arel/engines/sql/predicates.rb +48 -2
- data/lib/arel/engines/sql/primitives.rb +8 -0
- data/lib/arel/engines/sql/relations/compiler.rb +2 -2
- data/lib/arel/engines/sql/relations/operations/join.rb +1 -1
- data/lib/arel/engines/sql/relations/relation.rb +4 -0
- data/lib/arel/engines/sql/relations/table.rb +8 -4
- data/lib/arel/version.rb +1 -1
- data/spec/algebra/unit/relations/join_spec.rb +1 -2
- data/spec/algebra/unit/relations/table_spec.rb +1 -1
- data/spec/attributes/boolean_spec.rb +1 -1
- data/spec/attributes/float_spec.rb +1 -1
- data/spec/attributes/header_spec.rb +42 -0
- data/spec/attributes/integer_spec.rb +1 -1
- data/spec/attributes/string_spec.rb +1 -1
- data/spec/attributes/time_spec.rb +4 -2
- data/spec/engines/memory/integration/joins/cross_engine_spec.rb +3 -4
- data/spec/engines/sql/unit/predicates/in_spec.rb +23 -5
- data/spec/engines/sql/unit/predicates/noteq_spec.rb +75 -0
- data/spec/engines/sql/unit/primitives/attribute_spec.rb +0 -19
- data/spec/engines/sql/unit/relations/having_spec.rb +33 -0
- data/spec/relations/join_spec.rb +5 -3
- data/spec/relations/relation_spec.rb +2 -2
- data/spec/shared/relation_spec.rb +126 -13
- data/spec/support/check.rb +1 -1
- data/spec/support/connections/mysql_connection.rb +1 -1
- data/spec/support/connections/oracle_connection.rb +1 -1
- data/spec/support/connections/postgresql_connection.rb +1 -1
- data/spec/support/guards.rb +1 -1
- data/spec/support/matchers.rb +1 -1
- data/spec/support/matchers/be_like.rb +3 -3
- data/spec/support/matchers/have_rows.rb +1 -1
- data/spec/support/model.rb +6 -2
- metadata +7 -4
data/spec/support/check.rb
CHANGED
data/spec/support/guards.rb
CHANGED
data/spec/support/matchers.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
module Matchers
|
2
2
|
class BeLike
|
3
3
|
def initialize(expected)
|
4
|
-
@expected = expected
|
4
|
+
@expected = expected.gsub(/\s+/, ' ').strip
|
5
5
|
end
|
6
6
|
|
7
7
|
def matches?(actual)
|
8
|
-
@actual = actual
|
9
|
-
@expected
|
8
|
+
@actual = actual.gsub(/\s+/, ' ').strip
|
9
|
+
@expected == @actual
|
10
10
|
end
|
11
11
|
|
12
12
|
def failure_message
|
data/spec/support/model.rb
CHANGED
@@ -25,7 +25,7 @@ module Arel
|
|
25
25
|
class Model
|
26
26
|
include Relation
|
27
27
|
|
28
|
-
attr_reader :engine
|
28
|
+
attr_reader :engine
|
29
29
|
|
30
30
|
def self.build
|
31
31
|
relation = new
|
@@ -46,6 +46,10 @@ module Arel
|
|
46
46
|
@attributes << type.new(self, name)
|
47
47
|
end
|
48
48
|
|
49
|
+
def attributes
|
50
|
+
Header.new(@attributes)
|
51
|
+
end
|
52
|
+
|
49
53
|
def format(attribute, value)
|
50
54
|
value
|
51
55
|
end
|
@@ -55,4 +59,4 @@ module Arel
|
|
55
59
|
insert.record
|
56
60
|
end
|
57
61
|
end
|
58
|
-
end
|
62
|
+
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 4
|
8
|
+
- 0
|
9
|
+
version: 0.4.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Bryan Helmkamp
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-
|
19
|
+
date: 2010-06-08 00:00:00 -04:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- lib/arel/algebra/core_extensions/symbol.rb
|
64
64
|
- lib/arel/algebra/core_extensions.rb
|
65
65
|
- lib/arel/algebra/expression.rb
|
66
|
+
- lib/arel/algebra/header.rb
|
66
67
|
- lib/arel/algebra/ordering.rb
|
67
68
|
- lib/arel/algebra/predicates.rb
|
68
69
|
- lib/arel/algebra/relations/operations/alias.rb
|
@@ -181,6 +182,7 @@ test_files:
|
|
181
182
|
- spec/algebra/unit/session/session_spec.rb
|
182
183
|
- spec/attributes/boolean_spec.rb
|
183
184
|
- spec/attributes/float_spec.rb
|
185
|
+
- spec/attributes/header_spec.rb
|
184
186
|
- spec/attributes/integer_spec.rb
|
185
187
|
- spec/attributes/string_spec.rb
|
186
188
|
- spec/attributes/time_spec.rb
|
@@ -200,6 +202,7 @@ test_files:
|
|
200
202
|
- spec/engines/sql/unit/predicates/binary_spec.rb
|
201
203
|
- spec/engines/sql/unit/predicates/equality_spec.rb
|
202
204
|
- spec/engines/sql/unit/predicates/in_spec.rb
|
205
|
+
- spec/engines/sql/unit/predicates/noteq_spec.rb
|
203
206
|
- spec/engines/sql/unit/predicates/predicates_spec.rb
|
204
207
|
- spec/engines/sql/unit/primitives/attribute_spec.rb
|
205
208
|
- spec/engines/sql/unit/primitives/expression_spec.rb
|