veritas 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +4 -2
- data/Gemfile +7 -8
- data/README.rdoc +17 -18
- data/Rakefile +2 -2
- data/TODO +18 -14
- data/benchmarks/memory.rb +8 -7
- data/benchmarks/speed.rb +4 -3
- data/config/flay.yml +1 -1
- data/lib/veritas/aggregate.rb +3 -0
- data/lib/veritas/algebra/join.rb +11 -4
- data/lib/veritas/algebra/product.rb +2 -1
- data/lib/veritas/algebra/restriction.rb +3 -2
- data/lib/veritas/algebra/summarization.rb +8 -3
- data/lib/veritas/attribute/string.rb +3 -1
- data/lib/veritas/attribute.rb +1 -1
- data/lib/veritas/function/binary.rb +1 -0
- data/lib/veritas/function/comparable.rb +1 -0
- data/lib/veritas/function/connective/negation.rb +2 -0
- data/lib/veritas/function/proposition.rb +5 -1
- data/lib/veritas/function/unary.rb +1 -0
- data/lib/veritas/function.rb +3 -0
- data/lib/veritas/relation/base.rb +32 -3
- data/lib/veritas/relation/header.rb +2 -2
- data/lib/veritas/relation/materialized.rb +12 -0
- data/lib/veritas/relation/operation/binary.rb +1 -0
- data/lib/veritas/relation/operation/limit.rb +1 -1
- data/lib/veritas/relation/operation/offset.rb +1 -1
- data/lib/veritas/relation/operation/order/direction_set.rb +67 -5
- data/lib/veritas/relation/operation/order.rb +25 -3
- data/lib/veritas/relation/operation/set.rb +1 -0
- data/lib/veritas/relation.rb +20 -7
- data/lib/veritas/support/abstract_class.rb +1 -0
- data/lib/veritas/support/evaluator.rb +49 -3
- data/lib/veritas/support/immutable.rb +2 -1
- data/lib/veritas/tuple.rb +28 -14
- data/lib/veritas/version.rb +1 -1
- data/lib/veritas.rb +6 -3
- data/spec/integration/veritas/algebra/projection_spec.rb +4 -4
- data/spec/integration/veritas/relation/efficient_enumerable_spec.rb +1 -1
- data/spec/shared/each_method_behaviour.rb +2 -2
- data/spec/shared/hash_method_behavior.rb +2 -2
- data/spec/spec_helper.rb +1 -0
- data/spec/unit/date/pred_spec.rb +3 -3
- data/spec/unit/range/overlaps_spec.rb +14 -14
- data/spec/unit/range/to_inclusive_spec.rb +2 -2
- data/spec/unit/time/pred_spec.rb +3 -3
- data/spec/unit/veritas/abstract_class/class_methods/new_spec.rb +1 -1
- data/spec/unit/veritas/aggregate/count/class_methods/call_spec.rb +1 -1
- data/spec/unit/veritas/aggregate/count/methods/count_spec.rb +1 -1
- data/spec/unit/veritas/aggregate/maximum/methods/maximum_spec.rb +1 -1
- data/spec/unit/veritas/aggregate/mean/class_methods/call_spec.rb +1 -1
- data/spec/unit/veritas/aggregate/mean/methods/mean_spec.rb +1 -1
- data/spec/unit/veritas/aggregate/minimum/methods/minimum_spec.rb +1 -1
- data/spec/unit/veritas/aggregate/standard_deviation/methods/standard_deviation_spec.rb +1 -1
- data/spec/unit/veritas/aggregate/sum/class_methods/call_spec.rb +1 -1
- data/spec/unit/veritas/aggregate/sum/methods/sum_spec.rb +1 -1
- data/spec/unit/veritas/aggregate/variance/class_methods/call_spec.rb +1 -1
- data/spec/unit/veritas/aggregate/variance/methods/variance_spec.rb +1 -1
- data/spec/unit/veritas/algebra/difference/methods/difference_spec.rb +2 -2
- data/spec/unit/veritas/algebra/extension/class_methods/new_spec.rb +1 -1
- data/spec/unit/veritas/algebra/extension/eql_spec.rb +5 -5
- data/spec/unit/veritas/algebra/extension/header_spec.rb +1 -1
- data/spec/unit/veritas/algebra/extension/methods/extend_spec.rb +1 -1
- data/spec/unit/veritas/algebra/intersection/methods/intersect_spec.rb +2 -2
- data/spec/unit/veritas/algebra/join/class_methods/new_spec.rb +2 -2
- data/spec/unit/veritas/algebra/join/join_header_spec.rb +17 -0
- data/spec/unit/veritas/algebra/join/methods/join_spec.rb +2 -2
- data/spec/unit/veritas/algebra/product/class_methods/new_spec.rb +1 -1
- data/spec/unit/veritas/algebra/product/methods/product_spec.rb +1 -1
- data/spec/unit/veritas/algebra/projection/eql_spec.rb +5 -5
- data/spec/unit/veritas/algebra/projection/header_spec.rb +1 -1
- data/spec/unit/veritas/algebra/projection/methods/project_spec.rb +1 -1
- data/spec/unit/veritas/algebra/projection/methods/remove_spec.rb +1 -1
- data/spec/unit/veritas/algebra/rename/aliases/class_methods/coerce_spec.rb +4 -4
- data/spec/unit/veritas/algebra/rename/aliases/class_methods/new_spec.rb +1 -1
- data/spec/unit/veritas/algebra/rename/aliases/eql_spec.rb +4 -4
- data/spec/unit/veritas/algebra/rename/aliases/equal_value_spec.rb +4 -4
- data/spec/unit/veritas/algebra/rename/aliases/to_hash_spec.rb +1 -1
- data/spec/unit/veritas/algebra/rename/aliases/union_spec.rb +10 -10
- data/spec/unit/veritas/algebra/rename/directions_spec.rb +3 -3
- data/spec/unit/veritas/algebra/rename/eql_spec.rb +5 -5
- data/spec/unit/veritas/algebra/rename/header_spec.rb +1 -1
- data/spec/unit/veritas/algebra/rename/methods/rename_spec.rb +1 -1
- data/spec/unit/veritas/algebra/restriction/eql_spec.rb +5 -5
- data/spec/unit/veritas/algebra/restriction/methods/restrict_spec.rb +1 -1
- data/spec/unit/veritas/algebra/summarization/class_methods/new_spec.rb +1 -1
- data/spec/unit/veritas/algebra/summarization/eql_spec.rb +7 -7
- data/spec/unit/veritas/algebra/summarization/header_spec.rb +1 -1
- data/spec/unit/veritas/algebra/summarization/methods/summarize_spec.rb +18 -8
- data/spec/unit/veritas/algebra/summarization/summaries/summarize_by_spec.rb +3 -3
- data/spec/unit/veritas/algebra/summarization/summaries/to_hash_spec.rb +2 -2
- data/spec/unit/veritas/algebra/summarization/summary/summarize_by_spec.rb +1 -1
- data/spec/unit/veritas/algebra/union/methods/union_spec.rb +2 -2
- data/spec/unit/veritas/aliasable/inheritable_alias_spec.rb +2 -2
- data/spec/unit/veritas/attribute/class_methods/coerce_spec.rb +4 -4
- data/spec/unit/veritas/attribute/class_methods/descendants_spec.rb +2 -6
- data/spec/unit/veritas/attribute/class_methods/new_spec.rb +1 -1
- data/spec/unit/veritas/attribute/comparable/comparable_spec.rb +3 -3
- data/spec/unit/veritas/attribute/eql_spec.rb +4 -4
- data/spec/unit/veritas/attribute/equal_value_spec.rb +4 -4
- data/spec/unit/veritas/attribute/inspect_spec.rb +1 -1
- data/spec/unit/veritas/attribute/joinable_spec.rb +4 -4
- data/spec/unit/veritas/attribute/numeric/joinable_spec.rb +3 -3
- data/spec/unit/veritas/attribute/options_spec.rb +2 -2
- data/spec/unit/veritas/attribute/orderable/asc_spec.rb +1 -1
- data/spec/unit/veritas/attribute/orderable/desc_spec.rb +1 -1
- data/spec/unit/veritas/attribute/rename_spec.rb +1 -1
- data/spec/unit/veritas/attribute/string/joinable_spec.rb +14 -4
- data/spec/unit/veritas/evaluator/context/method_missing_spec.rb +29 -0
- data/spec/unit/veritas/evaluator/context/respond_to_spec.rb +39 -0
- data/spec/unit/veritas/evaluator/context/send_spec.rb +28 -0
- data/spec/unit/veritas/evaluator/context/yield_spec.rb +14 -0
- data/spec/unit/veritas/function/binary/equal_value_spec.rb +5 -5
- data/spec/unit/veritas/function/binary/invertible/inverse_spec.rb +1 -1
- data/spec/unit/veritas/function/binary/rename_spec.rb +3 -3
- data/spec/unit/veritas/function/connective/conjunction/inverse_spec.rb +1 -1
- data/spec/unit/veritas/function/connective/disjunction/inverse_spec.rb +1 -1
- data/spec/unit/veritas/function/connective/negation/methods/not_spec.rb +2 -2
- data/spec/unit/veritas/function/numeric/absolute/methods/absolute_spec.rb +1 -1
- data/spec/unit/veritas/function/numeric/addition/methods/add_spec.rb +1 -1
- data/spec/unit/veritas/function/numeric/division/methods/divide_spec.rb +1 -1
- data/spec/unit/veritas/function/numeric/exponentiation/inverse_spec.rb +1 -1
- data/spec/unit/veritas/function/numeric/exponentiation/methods/exponent_spec.rb +1 -1
- data/spec/unit/veritas/function/numeric/modulo/methods/modulo_spec.rb +1 -1
- data/spec/unit/veritas/function/numeric/multiplication/methods/multiply_spec.rb +1 -1
- data/spec/unit/veritas/function/numeric/square_root/methods/square_root_spec.rb +1 -1
- data/spec/unit/veritas/function/numeric/subtraction/methods/subtract_spec.rb +1 -1
- data/spec/unit/veritas/function/numeric/unary_minus/methods/unary_minus_spec.rb +1 -1
- data/spec/unit/veritas/function/numeric/unary_plus/methods/unary_plus_spec.rb +1 -1
- data/spec/unit/veritas/function/predicate/eql_spec.rb +5 -5
- data/spec/unit/veritas/function/predicate/equality/inverse_spec.rb +1 -1
- data/spec/unit/veritas/function/predicate/equality/methods/eq_spec.rb +1 -1
- data/spec/unit/veritas/function/predicate/exclusion/inverse_spec.rb +1 -1
- data/spec/unit/veritas/function/predicate/exclusion/methods/exclude_spec.rb +1 -1
- data/spec/unit/veritas/function/predicate/greater_than/inverse_spec.rb +1 -1
- data/spec/unit/veritas/function/predicate/greater_than/methods/gt_spec.rb +1 -1
- data/spec/unit/veritas/function/predicate/greater_than_or_equal_to/inverse_spec.rb +1 -1
- data/spec/unit/veritas/function/predicate/greater_than_or_equal_to/methods/gte_spec.rb +1 -1
- data/spec/unit/veritas/function/predicate/inclusion/inverse_spec.rb +1 -1
- data/spec/unit/veritas/function/predicate/inclusion/methods/include_spec.rb +1 -1
- data/spec/unit/veritas/function/predicate/inequality/inverse_spec.rb +1 -1
- data/spec/unit/veritas/function/predicate/inequality/methods/ne_spec.rb +1 -1
- data/spec/unit/veritas/function/predicate/inverse_spec.rb +1 -1
- data/spec/unit/veritas/function/predicate/less_than/inverse_spec.rb +1 -1
- data/spec/unit/veritas/function/predicate/less_than/methods/lt_spec.rb +1 -1
- data/spec/unit/veritas/function/predicate/less_than_or_equal_to/inverse_spec.rb +1 -1
- data/spec/unit/veritas/function/predicate/less_than_or_equal_to/methods/lte_spec.rb +1 -1
- data/spec/unit/veritas/function/predicate/match/inverse_spec.rb +1 -1
- data/spec/unit/veritas/function/predicate/match/methods/match_spec.rb +1 -1
- data/spec/unit/veritas/function/predicate/no_match/inverse_spec.rb +1 -1
- data/spec/unit/veritas/function/predicate/no_match/methods/no_match_spec.rb +1 -1
- data/spec/unit/veritas/function/proposition/eql_spec.rb +3 -3
- data/spec/unit/veritas/function/proposition/equal_value_spec.rb +3 -3
- data/spec/unit/veritas/function/string/length/methods/length_spec.rb +1 -1
- data/spec/unit/veritas/function/unary/equal_value_spec.rb +4 -4
- data/spec/unit/veritas/function/unary/invertible/inverse_spec.rb +1 -1
- data/spec/unit/veritas/function/unary/rename_spec.rb +1 -1
- data/spec/unit/veritas/immutable/class_methods/freeze_object_spec.rb +7 -1
- data/spec/unit/veritas/immutable/class_methods/new_spec.rb +1 -1
- data/spec/unit/veritas/immutable/freeze_spec.rb +2 -2
- data/spec/unit/veritas/immutable/module_methods/memoize_spec.rb +2 -2
- data/spec/unit/veritas/operation/binary/eql_spec.rb +5 -5
- data/spec/unit/veritas/operation/unary/eql_spec.rb +4 -4
- data/spec/unit/veritas/relation/base/class_methods/new_spec.rb +35 -0
- data/spec/unit/veritas/relation/base/eql_spec.rb +100 -0
- data/spec/unit/veritas/relation/base/hash_spec.rb +16 -0
- data/spec/unit/veritas/relation/class_methods/new_spec.rb +2 -2
- data/spec/unit/veritas/relation/directions_spec.rb +1 -1
- data/spec/unit/veritas/relation/eql_spec.rb +15 -15
- data/spec/unit/veritas/relation/equal_value_spec.rb +16 -16
- data/spec/unit/veritas/relation/header/class_methods/coerce_spec.rb +1 -1
- data/spec/unit/veritas/relation/header/class_methods/new_spec.rb +2 -2
- data/spec/unit/veritas/relation/header/difference_spec.rb +1 -1
- data/spec/unit/veritas/relation/header/eql_spec.rb +5 -5
- data/spec/unit/veritas/relation/header/equal_value_spec.rb +7 -7
- data/spec/unit/veritas/relation/header/inspect_spec.rb +1 -1
- data/spec/unit/veritas/relation/header/intersect_spec.rb +1 -1
- data/spec/unit/veritas/relation/header/project_spec.rb +1 -1
- data/spec/unit/veritas/relation/header/rename_spec.rb +1 -1
- data/spec/unit/veritas/relation/header/to_ary_spec.rb +1 -1
- data/spec/unit/veritas/relation/header/union_spec.rb +1 -1
- data/spec/unit/veritas/relation/materialize_spec.rb +3 -3
- data/spec/unit/veritas/relation/materialized/class_methods/new_spec.rb +2 -2
- data/spec/unit/veritas/relation/materialized/materialized_spec.rb +15 -0
- data/spec/unit/veritas/relation/materialized_spec.rb +15 -0
- data/spec/unit/veritas/relation/operation/binary/class_methods/new_spec.rb +6 -6
- data/spec/unit/veritas/relation/operation/binary/header_spec.rb +1 -1
- data/spec/unit/veritas/relation/operation/combination/header_spec.rb +1 -1
- data/spec/unit/veritas/relation/operation/limit/class_methods/new_spec.rb +12 -5
- data/spec/unit/veritas/relation/operation/limit/directions_spec.rb +1 -1
- data/spec/unit/veritas/relation/operation/limit/each_spec.rb +1 -1
- data/spec/unit/veritas/relation/operation/limit/eql_spec.rb +11 -11
- data/spec/unit/veritas/relation/operation/limit/hash_spec.rb +1 -1
- data/spec/unit/veritas/relation/operation/limit/limit_spec.rb +1 -1
- data/spec/unit/veritas/relation/operation/limit/methods/first_spec.rb +3 -3
- data/spec/unit/veritas/relation/operation/limit/methods/last_spec.rb +3 -3
- data/spec/unit/veritas/relation/operation/limit/methods/take_spec.rb +2 -2
- data/spec/unit/veritas/relation/operation/offset/class_methods/new_spec.rb +12 -5
- data/spec/unit/veritas/relation/operation/offset/directions_spec.rb +1 -1
- data/spec/unit/veritas/relation/operation/offset/each_spec.rb +1 -1
- data/spec/unit/veritas/relation/operation/offset/eql_spec.rb +11 -11
- data/spec/unit/veritas/relation/operation/offset/hash_spec.rb +1 -1
- data/spec/unit/veritas/relation/operation/offset/methods/drop_spec.rb +2 -2
- data/spec/unit/veritas/relation/operation/offset/offset_spec.rb +1 -1
- data/spec/unit/veritas/relation/operation/order/ascending/reverse_spec.rb +1 -1
- data/spec/unit/veritas/relation/operation/order/class_methods/new_spec.rb +3 -7
- data/spec/unit/veritas/relation/operation/order/descending/reverse_spec.rb +1 -1
- data/spec/unit/veritas/relation/operation/order/direction/class_methods/coerce_spec.rb +1 -1
- data/spec/unit/veritas/relation/operation/order/direction/eql_spec.rb +4 -4
- data/spec/unit/veritas/relation/operation/order/direction/rename_spec.rb +1 -1
- data/spec/unit/veritas/relation/operation/order/direction_set/attributes_spec.rb +1 -1
- data/spec/unit/veritas/relation/operation/order/direction_set/class_methods/coerce_spec.rb +4 -4
- data/spec/unit/veritas/relation/operation/order/direction_set/class_methods/new_spec.rb +32 -0
- data/spec/unit/veritas/relation/operation/order/direction_set/eql_spec.rb +4 -4
- data/spec/unit/veritas/relation/operation/order/direction_set/equal_value_spec.rb +6 -6
- data/spec/unit/veritas/relation/operation/order/direction_set/project_spec.rb +1 -1
- data/spec/unit/veritas/relation/operation/order/direction_set/rename_spec.rb +1 -1
- data/spec/unit/veritas/relation/operation/order/direction_set/reverse_spec.rb +2 -2
- data/spec/unit/veritas/relation/operation/order/direction_set/sort_tuples_spec.rb +4 -4
- data/spec/unit/veritas/relation/operation/order/direction_set/to_ary_spec.rb +1 -1
- data/spec/unit/veritas/relation/operation/order/direction_set/union_spec.rb +1 -1
- data/spec/unit/veritas/relation/operation/order/eql_spec.rb +5 -5
- data/spec/unit/veritas/relation/operation/order/methods/order_spec.rb +24 -4
- data/spec/unit/veritas/relation/operation/order/methods/sort_by_spec.rb +28 -0
- data/spec/unit/veritas/relation/operation/reverse/class_methods/new_spec.rb +6 -6
- data/spec/unit/veritas/relation/operation/reverse/directions_spec.rb +1 -1
- data/spec/unit/veritas/relation/operation/reverse/each_spec.rb +1 -1
- data/spec/unit/veritas/relation/operation/reverse/methods/reverse_spec.rb +2 -2
- data/spec/unit/veritas/relation/operation/set/class_methods/new_spec.rb +1 -1
- data/spec/unit/veritas/tuple/class_methods/coerce_spec.rb +1 -1
- data/spec/unit/veritas/tuple/data_spec.rb +16 -0
- data/spec/unit/veritas/tuple/element_reference_spec.rb +1 -1
- data/spec/unit/veritas/tuple/eql_spec.rb +5 -5
- data/spec/unit/veritas/tuple/equal_value_spec.rb +7 -7
- data/spec/unit/veritas/tuple/extend_spec.rb +3 -3
- data/spec/unit/veritas/tuple/hash_spec.rb +1 -1
- data/spec/unit/veritas/tuple/inspect_spec.rb +2 -2
- data/spec/unit/veritas/tuple/join_spec.rb +1 -1
- data/spec/unit/veritas/tuple/predicate_spec.rb +44 -0
- data/spec/unit/veritas/tuple/project_spec.rb +1 -1
- data/spec/unit/veritas/tuple/to_ary_spec.rb +3 -1
- data/tasks/metrics/heckle.rake +1 -0
- data/veritas.gemspec +28 -14
- metadata +31 -17
@@ -5,14 +5,14 @@ require 'spec_helper'
|
|
5
5
|
describe Relation, '#materialize' do
|
6
6
|
subject { object.materialize }
|
7
7
|
|
8
|
-
let(:header) { Relation::Header.new([ [ :id, Integer ] ])
|
9
|
-
let(:object) { described_class.new(header, [ [ 1 ] ].each).
|
8
|
+
let(:header) { Relation::Header.new([ [ :id, Integer ] ]) }
|
9
|
+
let(:object) { described_class.new(header, [ [ 1 ] ].each).sort_by { |r| r.id } }
|
10
10
|
|
11
11
|
before do
|
12
12
|
object.should be_kind_of(described_class)
|
13
13
|
end
|
14
14
|
|
15
|
-
it { should
|
15
|
+
it { should be_instance_of(Relation::Materialized) }
|
16
16
|
|
17
17
|
its(:header) { should equal(header) }
|
18
18
|
|
@@ -12,7 +12,7 @@ describe Relation::Materialized, '.new' do
|
|
12
12
|
|
13
13
|
let(:directions) { [ header[:id] ] }
|
14
14
|
|
15
|
-
it { should
|
15
|
+
it { should be_instance_of(object) }
|
16
16
|
|
17
17
|
its(:header) { should equal(header) }
|
18
18
|
|
@@ -24,7 +24,7 @@ describe Relation::Materialized, '.new' do
|
|
24
24
|
context 'with no directions' do
|
25
25
|
subject { object.new(header, tuples) }
|
26
26
|
|
27
|
-
it { should
|
27
|
+
it { should be_instance_of(object) }
|
28
28
|
|
29
29
|
its(:header) { should equal(header) }
|
30
30
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Relation::Materialized, '#materialized?' do
|
6
|
+
subject { object.materialized? }
|
7
|
+
|
8
|
+
let(:object) { described_class.new([ [ :id, Integer ] ], [ [ 1 ] ]) }
|
9
|
+
|
10
|
+
before do
|
11
|
+
object.should be_instance_of(described_class)
|
12
|
+
end
|
13
|
+
|
14
|
+
it { should be(true) }
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Relation, '#materialized?' do
|
6
|
+
subject { object.materialized? }
|
7
|
+
|
8
|
+
let(:object) { described_class.new([ [ :id, Integer ] ], [].each) }
|
9
|
+
|
10
|
+
before do
|
11
|
+
object.should be_instance_of(described_class)
|
12
|
+
end
|
13
|
+
|
14
|
+
it { should be(false) }
|
15
|
+
end
|
@@ -11,21 +11,21 @@ require File.expand_path('../../fixtures/classes', __FILE__)
|
|
11
11
|
let(:object) { BinaryRelationOperationSpecs::Object }
|
12
12
|
|
13
13
|
context 'with left and right ordered' do
|
14
|
-
let(:left) { original_left.
|
15
|
-
let(:right) { original_right.
|
14
|
+
let(:left) { original_left.sort_by { |r| r.id } }
|
15
|
+
let(:right) { original_right.sort_by { |r| r.name } }
|
16
16
|
|
17
|
-
it { should
|
17
|
+
it { should be_instance_of(object) }
|
18
18
|
end
|
19
19
|
|
20
20
|
context 'with left and right unordered' do
|
21
21
|
let(:left) { original_left }
|
22
22
|
let(:right) { original_right }
|
23
23
|
|
24
|
-
it { should
|
24
|
+
it { should be_instance_of(object) }
|
25
25
|
end
|
26
26
|
|
27
27
|
context 'with left ordered, and right unordered' do
|
28
|
-
let(:left) { original_left.
|
28
|
+
let(:left) { original_left.sort_by { |r| r.id } }
|
29
29
|
let(:right) { original_right }
|
30
30
|
|
31
31
|
specify { expect { subject }.to raise_error(RelationMismatchError, 'both relations must be ordered or neither may be ordered') }
|
@@ -33,7 +33,7 @@ require File.expand_path('../../fixtures/classes', __FILE__)
|
|
33
33
|
|
34
34
|
context 'with right ordered, and left unordered' do
|
35
35
|
let(:left) { original_left }
|
36
|
-
let(:right) { original_right.
|
36
|
+
let(:right) { original_right.sort_by { |r| r.name } }
|
37
37
|
|
38
38
|
specify { expect { subject }.to raise_error(RelationMismatchError, 'both relations must be ordered or neither may be ordered') }
|
39
39
|
end
|
@@ -13,7 +13,7 @@ describe Relation::Operation::Binary, '#header' do
|
|
13
13
|
|
14
14
|
it_should_behave_like 'an idempotent method'
|
15
15
|
|
16
|
-
it { should
|
16
|
+
it { should be_instance_of(Relation::Header) }
|
17
17
|
|
18
18
|
it { should == [ [ :id, Integer ], [ :name, String ] ] }
|
19
19
|
end
|
@@ -13,7 +13,7 @@ describe Relation::Operation::Combination, '#header' do
|
|
13
13
|
|
14
14
|
it_should_behave_like 'an idempotent method'
|
15
15
|
|
16
|
-
it { should
|
16
|
+
it { should be_instance_of(Relation::Header) }
|
17
17
|
|
18
18
|
it 'unions the headers' do
|
19
19
|
should == [ [ :id, Integer ], [ :name, String ] ]
|
@@ -9,17 +9,17 @@ describe Relation::Operation::Limit, '.new' do
|
|
9
9
|
let(:object) { described_class }
|
10
10
|
|
11
11
|
context 'with an ordered relation' do
|
12
|
-
let(:relation) { original_relation.
|
12
|
+
let(:relation) { original_relation.sort_by { |r| r.id } }
|
13
13
|
let(:limit) { 1 }
|
14
14
|
|
15
|
-
it { should
|
15
|
+
it { should be_instance_of(object) }
|
16
16
|
end
|
17
17
|
|
18
18
|
context 'with an ordered relation having an empty header' do
|
19
|
-
let(:relation) { original_relation.
|
19
|
+
let(:relation) { original_relation.sort_by { |r| r.id }.project([]) }
|
20
20
|
let(:limit) { 1 }
|
21
21
|
|
22
|
-
it { should
|
22
|
+
it { should be_instance_of(object) }
|
23
23
|
end
|
24
24
|
|
25
25
|
context 'without an ordered relation' do
|
@@ -30,9 +30,16 @@ describe Relation::Operation::Limit, '.new' do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
context 'with an limit less than 0' do
|
33
|
-
let(:relation) { original_relation.
|
33
|
+
let(:relation) { original_relation.sort_by { |r| r.id } }
|
34
34
|
let(:limit) { -1 }
|
35
35
|
|
36
36
|
specify { expect { subject }.to raise_error(InvalidLimitError, 'limit must be greater than or equal to 0, but was -1') }
|
37
37
|
end
|
38
|
+
|
39
|
+
context 'with a nil limit' do
|
40
|
+
let(:relation) { original_relation.sort_by { |r| r.id } }
|
41
|
+
let(:limit) { nil }
|
42
|
+
|
43
|
+
specify { expect { subject }.to raise_error(InvalidLimitError, 'limit must be greater than or equal to 0, but was nil') }
|
44
|
+
end
|
38
45
|
end
|
@@ -7,7 +7,7 @@ describe Relation::Operation::Limit, '#directions' do
|
|
7
7
|
|
8
8
|
let(:relation) { Relation.new([ [ :id, Integer ] ], [].each) }
|
9
9
|
let(:object) { described_class.new(ordered, 1) }
|
10
|
-
let(:ordered) { relation.
|
10
|
+
let(:ordered) { relation.sort_by { |r| r.id } }
|
11
11
|
|
12
12
|
it_should_behave_like 'an idempotent method'
|
13
13
|
|
@@ -6,7 +6,7 @@ describe Relation::Operation::Limit, '#each' do
|
|
6
6
|
subject { object.each { |tuple| yields << tuple } }
|
7
7
|
|
8
8
|
let(:relation) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ], [ 3 ] ]) }
|
9
|
-
let(:order) { relation.
|
9
|
+
let(:order) { relation.sort_by { |r| r.id } }
|
10
10
|
let(:object) { described_class.new(order, 1) }
|
11
11
|
let(:yields) { [] }
|
12
12
|
|
@@ -5,9 +5,9 @@ require 'spec_helper'
|
|
5
5
|
describe Relation::Operation::Limit, '#eql?' do
|
6
6
|
subject { object.eql?(other) }
|
7
7
|
|
8
|
-
let(:operand) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ], [ 3 ] ]).
|
9
|
-
let(:limit) { 1
|
10
|
-
let(:object) { described_class.new(operand, limit)
|
8
|
+
let(:operand) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ], [ 3 ] ]).sort_by { |r| r.id } }
|
9
|
+
let(:limit) { 1 }
|
10
|
+
let(:object) { described_class.new(operand, limit) }
|
11
11
|
|
12
12
|
context 'with the same object' do
|
13
13
|
let(:other) { object }
|
@@ -15,7 +15,7 @@ describe Relation::Operation::Limit, '#eql?' do
|
|
15
15
|
it { should be(true) }
|
16
16
|
|
17
17
|
it 'is symmetric' do
|
18
|
-
should
|
18
|
+
should eql(other.eql?(object))
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -25,7 +25,7 @@ describe Relation::Operation::Limit, '#eql?' do
|
|
25
25
|
it { should be(true) }
|
26
26
|
|
27
27
|
it 'is symmetric' do
|
28
|
-
should
|
28
|
+
should eql(other.eql?(object))
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -35,19 +35,19 @@ describe Relation::Operation::Limit, '#eql?' do
|
|
35
35
|
it { should be(false) }
|
36
36
|
|
37
37
|
it 'is symmetric' do
|
38
|
-
should
|
38
|
+
should eql(other.eql?(object))
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
context 'with an object having a different operand' do
|
43
|
-
let(:other_operand) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ] ]).
|
44
|
-
let(:other_limit) { limit
|
45
|
-
let(:other) { described_class.new(other_operand, other_limit)
|
43
|
+
let(:other_operand) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ] ]).sort_by { |r| r.id } }
|
44
|
+
let(:other_limit) { limit }
|
45
|
+
let(:other) { described_class.new(other_operand, other_limit) }
|
46
46
|
|
47
47
|
it { should be(false) }
|
48
48
|
|
49
49
|
it 'is symmetric' do
|
50
|
-
should
|
50
|
+
should eql(other.eql?(object))
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -59,7 +59,7 @@ describe Relation::Operation::Limit, '#eql?' do
|
|
59
59
|
it { should be(false) }
|
60
60
|
|
61
61
|
it 'is symmetric' do
|
62
|
-
should
|
62
|
+
should eql(other.eql?(object))
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
@@ -6,7 +6,7 @@ describe Relation::Operation::Limit, '#hash' do
|
|
6
6
|
subject { object.hash }
|
7
7
|
|
8
8
|
let(:relation) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ], [ 3 ] ]) }
|
9
|
-
let(:operand) { relation.
|
9
|
+
let(:operand) { relation.sort_by { |r| r.id } }
|
10
10
|
let(:limit) { 1 }
|
11
11
|
let(:object) { described_class.new(operand, limit) }
|
12
12
|
|
@@ -6,7 +6,7 @@ describe Relation::Operation::Limit, '#limit' do
|
|
6
6
|
subject { object.limit }
|
7
7
|
|
8
8
|
let(:relation) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ], [ 3 ] ]) }
|
9
|
-
let(:order) { relation.
|
9
|
+
let(:order) { relation.sort_by { |r| r.id } }
|
10
10
|
let(:limit) { 1 }
|
11
11
|
let(:object) { described_class.new(order, limit) }
|
12
12
|
|
@@ -5,12 +5,12 @@ require 'spec_helper'
|
|
5
5
|
describe Relation::Operation::Limit::Methods, '#first' do
|
6
6
|
let(:described_class) { Relation }
|
7
7
|
let(:relation) { described_class.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ], [ 3 ] ].each) }
|
8
|
-
let(:object) { relation.
|
8
|
+
let(:object) { relation.sort_by { |r| r.id } }
|
9
9
|
|
10
10
|
context 'with no arguments' do
|
11
11
|
subject { object.first }
|
12
12
|
|
13
|
-
it { should
|
13
|
+
it { should be_instance_of(Relation::Operation::Limit) }
|
14
14
|
|
15
15
|
its(:limit) { should == 1 }
|
16
16
|
|
@@ -28,7 +28,7 @@ describe Relation::Operation::Limit::Methods, '#first' do
|
|
28
28
|
|
29
29
|
let(:limit) { 2 }
|
30
30
|
|
31
|
-
it { should
|
31
|
+
it { should be_instance_of(Relation::Operation::Limit) }
|
32
32
|
|
33
33
|
its(:limit) { should == limit }
|
34
34
|
|
@@ -5,12 +5,12 @@ require 'spec_helper'
|
|
5
5
|
describe Relation::Operation::Limit::Methods, '#last' do
|
6
6
|
let(:described_class) { Relation }
|
7
7
|
let(:relation) { described_class.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ], [ 3 ] ].each) }
|
8
|
-
let(:object) { relation.
|
8
|
+
let(:object) { relation.sort_by { |r| r.id } }
|
9
9
|
|
10
10
|
context 'with no arguments' do
|
11
11
|
subject { object.last }
|
12
12
|
|
13
|
-
it { should
|
13
|
+
it { should be_instance_of(Relation::Operation::Reverse) }
|
14
14
|
|
15
15
|
it 'returns the expected tuples' do
|
16
16
|
should == [ [ 3 ] ]
|
@@ -26,7 +26,7 @@ describe Relation::Operation::Limit::Methods, '#last' do
|
|
26
26
|
|
27
27
|
let(:limit) { 2 }
|
28
28
|
|
29
|
-
it { should
|
29
|
+
it { should be_instance_of(Relation::Operation::Reverse) }
|
30
30
|
|
31
31
|
it 'returns the expected tuples' do
|
32
32
|
should == [ [ 2 ], [ 3 ] ]
|
@@ -8,9 +8,9 @@ describe Relation::Operation::Limit::Methods, '#take' do
|
|
8
8
|
let(:described_class) { Relation }
|
9
9
|
let(:limit) { 1 }
|
10
10
|
let(:relation) { described_class.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ] ].each) }
|
11
|
-
let(:object) { relation.
|
11
|
+
let(:object) { relation.sort_by { |r| r.id } }
|
12
12
|
|
13
|
-
it { should
|
13
|
+
it { should be_instance_of(Relation::Operation::Limit) }
|
14
14
|
|
15
15
|
its(:limit) { should == limit }
|
16
16
|
|
@@ -9,17 +9,17 @@ describe Relation::Operation::Offset, '.new' do
|
|
9
9
|
let(:object) { described_class }
|
10
10
|
|
11
11
|
context 'with an ordered relation' do
|
12
|
-
let(:relation) { original_relation.
|
12
|
+
let(:relation) { original_relation.sort_by { |r| r.id } }
|
13
13
|
let(:offset) { 1 }
|
14
14
|
|
15
|
-
it { should
|
15
|
+
it { should be_instance_of(object) }
|
16
16
|
end
|
17
17
|
|
18
18
|
context 'with an ordered relation having an empty header' do
|
19
|
-
let(:relation) { original_relation.
|
19
|
+
let(:relation) { original_relation.sort_by { |r| r.id }.project([]) }
|
20
20
|
let(:offset) { 1 }
|
21
21
|
|
22
|
-
it { should
|
22
|
+
it { should be_instance_of(object) }
|
23
23
|
end
|
24
24
|
|
25
25
|
context 'without an ordered relation' do
|
@@ -30,9 +30,16 @@ describe Relation::Operation::Offset, '.new' do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
context 'with an offset less than 0' do
|
33
|
-
let(:relation) { original_relation.
|
33
|
+
let(:relation) { original_relation.sort_by { |r| r.id } }
|
34
34
|
let(:offset) { -1 }
|
35
35
|
|
36
36
|
specify { expect { subject }.to raise_error(InvalidOffsetError, 'offset must be greater than or equal to 0, but was -1') }
|
37
37
|
end
|
38
|
+
|
39
|
+
context 'with a nil offset' do
|
40
|
+
let(:relation) { original_relation.sort_by { |r| r.id } }
|
41
|
+
let(:offset) { nil }
|
42
|
+
|
43
|
+
specify { expect { subject }.to raise_error(InvalidOffsetError, 'offset must be greater than or equal to 0, but was nil') }
|
44
|
+
end
|
38
45
|
end
|
@@ -7,7 +7,7 @@ describe Relation::Operation::Offset, '#directions' do
|
|
7
7
|
|
8
8
|
let(:relation) { Relation.new([ [ :id, Integer ] ], [].each) }
|
9
9
|
let(:object) { described_class.new(ordered, 0) }
|
10
|
-
let(:ordered) { relation.
|
10
|
+
let(:ordered) { relation.sort_by { |r| r.id } }
|
11
11
|
|
12
12
|
it_should_behave_like 'an idempotent method'
|
13
13
|
|
@@ -6,7 +6,7 @@ describe Relation::Operation::Offset, '#each' do
|
|
6
6
|
subject { object.each { |tuple| yields << tuple } }
|
7
7
|
|
8
8
|
let(:relation) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ], [ 3 ] ]) }
|
9
|
-
let(:order) { relation.
|
9
|
+
let(:order) { relation.sort_by { |r| r.id } }
|
10
10
|
let(:object) { described_class.new(order, 1) }
|
11
11
|
let(:yields) { [] }
|
12
12
|
|
@@ -5,9 +5,9 @@ require 'spec_helper'
|
|
5
5
|
describe Relation::Operation::Offset, '#eql?' do
|
6
6
|
subject { object.eql?(other) }
|
7
7
|
|
8
|
-
let(:operand) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ], [ 3 ] ]).
|
9
|
-
let(:offset) { 1
|
10
|
-
let(:object) { described_class.new(operand, offset)
|
8
|
+
let(:operand) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ], [ 3 ] ]).sort_by { |r| r.id } }
|
9
|
+
let(:offset) { 1 }
|
10
|
+
let(:object) { described_class.new(operand, offset) }
|
11
11
|
|
12
12
|
context 'with the same object' do
|
13
13
|
let(:other) { object }
|
@@ -15,7 +15,7 @@ describe Relation::Operation::Offset, '#eql?' do
|
|
15
15
|
it { should be(true) }
|
16
16
|
|
17
17
|
it 'is symmetric' do
|
18
|
-
should
|
18
|
+
should eql(other.eql?(object))
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -25,7 +25,7 @@ describe Relation::Operation::Offset, '#eql?' do
|
|
25
25
|
it { should be(true) }
|
26
26
|
|
27
27
|
it 'is symmetric' do
|
28
|
-
should
|
28
|
+
should eql(other.eql?(object))
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -35,19 +35,19 @@ describe Relation::Operation::Offset, '#eql?' do
|
|
35
35
|
it { should be(false) }
|
36
36
|
|
37
37
|
it 'is symmetric' do
|
38
|
-
should
|
38
|
+
should eql(other.eql?(object))
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
context 'with an object having a different operand' do
|
43
|
-
let(:other_operand) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ] ]).
|
44
|
-
let(:other_offset) { offset
|
45
|
-
let(:other) { described_class.new(other_operand, other_offset)
|
43
|
+
let(:other_operand) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ] ]).sort_by { |r| r.id } }
|
44
|
+
let(:other_offset) { offset }
|
45
|
+
let(:other) { described_class.new(other_operand, other_offset) }
|
46
46
|
|
47
47
|
it { should be(false) }
|
48
48
|
|
49
49
|
it 'is symmetric' do
|
50
|
-
should
|
50
|
+
should eql(other.eql?(object))
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -59,7 +59,7 @@ describe Relation::Operation::Offset, '#eql?' do
|
|
59
59
|
it { should be(false) }
|
60
60
|
|
61
61
|
it 'is symmetric' do
|
62
|
-
should
|
62
|
+
should eql(other.eql?(object))
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
@@ -6,7 +6,7 @@ describe Relation::Operation::Offset, '#hash' do
|
|
6
6
|
subject { object.hash }
|
7
7
|
|
8
8
|
let(:relation) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ], [ 3 ] ]) }
|
9
|
-
let(:operand) { relation.
|
9
|
+
let(:operand) { relation.sort_by { |r| r.id } }
|
10
10
|
let(:offset) { 1 }
|
11
11
|
let(:object) { described_class.new(operand, offset) }
|
12
12
|
|
@@ -8,9 +8,9 @@ describe Relation::Operation::Offset::Methods, '#drop' do
|
|
8
8
|
let(:described_class) { Relation }
|
9
9
|
let(:offset) { 1 }
|
10
10
|
let(:relation) { described_class.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ] ].each) }
|
11
|
-
let(:object) { relation.
|
11
|
+
let(:object) { relation.sort_by { |r| r.id } }
|
12
12
|
|
13
|
-
it { should
|
13
|
+
it { should be_instance_of(Relation::Operation::Offset) }
|
14
14
|
|
15
15
|
its(:offset) { should == offset }
|
16
16
|
|
@@ -6,7 +6,7 @@ describe Relation::Operation::Offset, '#offset' do
|
|
6
6
|
subject { object.offset }
|
7
7
|
|
8
8
|
let(:relation) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ], [ 3 ] ]) }
|
9
|
-
let(:order) { relation.
|
9
|
+
let(:order) { relation.sort_by { |r| r.id } }
|
10
10
|
let(:offset) { 1 }
|
11
11
|
let(:object) { described_class.new(order, offset) }
|
12
12
|
|
@@ -8,7 +8,7 @@ describe Relation::Operation::Order::Ascending, '#reverse' do
|
|
8
8
|
let(:attribute) { Attribute::Integer.new(:id) }
|
9
9
|
let(:object) { described_class.new(attribute) }
|
10
10
|
|
11
|
-
it { should
|
11
|
+
it { should be_instance_of(Relation::Operation::Order::Descending) }
|
12
12
|
|
13
13
|
its(:attribute) { should equal(attribute) }
|
14
14
|
end
|
@@ -13,7 +13,7 @@ describe Relation::Operation::Order, '.new' do
|
|
13
13
|
context 'with all attributes specified in the directions' do
|
14
14
|
let(:directions) { [ relation[:id], relation[:name] ] }
|
15
15
|
|
16
|
-
it { should
|
16
|
+
it { should be_instance_of(object) }
|
17
17
|
|
18
18
|
its(:operand) { should equal(relation) }
|
19
19
|
|
@@ -23,15 +23,11 @@ describe Relation::Operation::Order, '.new' do
|
|
23
23
|
context 'without no attributes specified in the directions' do
|
24
24
|
let(:directions) { [] }
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
its(:operand) { should equal(relation) }
|
29
|
-
|
30
|
-
its(:directions) { should == [ relation[:id].asc, relation[:name].asc ] }
|
26
|
+
specify { expect { subject }.to raise_error(InvalidDirectionsError, 'directions must include every attribute in the header') }
|
31
27
|
end
|
32
28
|
|
33
29
|
context 'without all attributes specified in the directions' do
|
34
|
-
let(:directions) { [ :id ] }
|
30
|
+
let(:directions) { [ relation[:id] ] }
|
35
31
|
|
36
32
|
specify { expect { subject }.to raise_error(InvalidDirectionsError, 'directions must include every attribute in the header') }
|
37
33
|
end
|
@@ -8,7 +8,7 @@ describe Relation::Operation::Order::Descending, '#reverse' do
|
|
8
8
|
let(:attribute) { Attribute::Integer.new(:id) }
|
9
9
|
let(:object) { described_class.new(attribute) }
|
10
10
|
|
11
|
-
it { should
|
11
|
+
it { should be_instance_of(Relation::Operation::Order::Ascending) }
|
12
12
|
|
13
13
|
its(:attribute) { should equal(attribute) }
|
14
14
|
end
|
@@ -17,7 +17,7 @@ describe Relation::Operation::Order::Direction, '.coerce' do
|
|
17
17
|
context 'when the argument is an Attribute' do
|
18
18
|
let(:argument) { attribute }
|
19
19
|
|
20
|
-
it { should
|
20
|
+
it { should be_instance_of(object) }
|
21
21
|
|
22
22
|
its(:attribute) { should equal(attribute) }
|
23
23
|
end
|
@@ -16,7 +16,7 @@ require 'spec_helper'
|
|
16
16
|
it { should be(true) }
|
17
17
|
|
18
18
|
it 'is symmetric' do
|
19
|
-
should
|
19
|
+
should eql(other.send(method, object))
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -26,7 +26,7 @@ require 'spec_helper'
|
|
26
26
|
it { should be(true) }
|
27
27
|
|
28
28
|
it 'is symmetric' do
|
29
|
-
should
|
29
|
+
should eql(other.send(method, object))
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -36,7 +36,7 @@ require 'spec_helper'
|
|
36
36
|
it { should be(false) }
|
37
37
|
|
38
38
|
it 'is symmetric' do
|
39
|
-
should
|
39
|
+
should eql(other.send(method, object))
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -47,7 +47,7 @@ require 'spec_helper'
|
|
47
47
|
it { should be(false) }
|
48
48
|
|
49
49
|
it 'is symmetric' do
|
50
|
-
should
|
50
|
+
should eql(other.send(method, object))
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
@@ -13,7 +13,7 @@ describe Relation::Operation::Order::Direction, '#rename' do
|
|
13
13
|
context 'with aliases matching the attribute' do
|
14
14
|
let(:aliases) { Algebra::Rename::Aliases.coerce(header, :id => :other_id) }
|
15
15
|
|
16
|
-
it { should
|
16
|
+
it { should be_instance_of(described_class) }
|
17
17
|
|
18
18
|
its(:attribute) { should == attribute.rename(:other_id) }
|
19
19
|
end
|
@@ -8,7 +8,7 @@ describe Relation::Operation::Order::DirectionSet, '#attributes' do
|
|
8
8
|
let(:attribute) { Attribute::Integer.new(:id) }
|
9
9
|
let(:object) { described_class.new([ attribute ]) }
|
10
10
|
|
11
|
-
it { should
|
11
|
+
it { should be_instance_of(Array) }
|
12
12
|
|
13
13
|
it { should == [ attribute ] }
|
14
14
|
end
|
@@ -5,9 +5,9 @@ require 'spec_helper'
|
|
5
5
|
describe Relation::Operation::Order::DirectionSet, '.coerce' do
|
6
6
|
subject { object.coerce(argument) }
|
7
7
|
|
8
|
-
let(:directions) { [ :id ]
|
9
|
-
let(:object) { described_class
|
10
|
-
let(:direction_set) { object.new(directions)
|
8
|
+
let(:directions) { [ Attribute::Integer.new(:id) ] }
|
9
|
+
let(:object) { described_class }
|
10
|
+
let(:direction_set) { object.new(directions) }
|
11
11
|
|
12
12
|
context 'when the argument is a DirectionSet' do
|
13
13
|
let(:argument) { direction_set }
|
@@ -18,7 +18,7 @@ describe Relation::Operation::Order::DirectionSet, '.coerce' do
|
|
18
18
|
context 'when the argument responds to #to_ary' do
|
19
19
|
let(:argument) { directions }
|
20
20
|
|
21
|
-
it { should
|
21
|
+
it { should be_instance_of(object) }
|
22
22
|
|
23
23
|
it { should == direction_set }
|
24
24
|
end
|