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
@@ -0,0 +1,14 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Evaluator::Context, '#yield' do
|
6
|
+
subject { object.yield }
|
7
|
+
|
8
|
+
let(:attribute) { Attribute::Integer.new(:id) }
|
9
|
+
let(:header) { Relation::Header.new([ attribute ]) }
|
10
|
+
let(:return_value) { mock('Return Value') }
|
11
|
+
let(:object) { described_class.new(header) { return_value } }
|
12
|
+
|
13
|
+
it { should equal(return_value) }
|
14
|
+
end
|
@@ -19,7 +19,7 @@ describe Function::Binary, '#==' do
|
|
19
19
|
it { should be(true) }
|
20
20
|
|
21
21
|
it 'is symmetric' do
|
22
|
-
should
|
22
|
+
should eql(other == object)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -29,7 +29,7 @@ describe Function::Binary, '#==' do
|
|
29
29
|
it { should be(true) }
|
30
30
|
|
31
31
|
it 'is symmetric' do
|
32
|
-
should
|
32
|
+
should eql(other == object)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -39,7 +39,7 @@ describe Function::Binary, '#==' do
|
|
39
39
|
it { should be(true) }
|
40
40
|
|
41
41
|
it 'is symmetric' do
|
42
|
-
should
|
42
|
+
should eql(other == object)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -50,7 +50,7 @@ describe Function::Binary, '#==' do
|
|
50
50
|
it { should be(false) }
|
51
51
|
|
52
52
|
it 'is symmetric' do
|
53
|
-
should
|
53
|
+
should eql(other == object)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -61,7 +61,7 @@ describe Function::Binary, '#==' do
|
|
61
61
|
it { should be(false) }
|
62
62
|
|
63
63
|
it 'is symmetric' do
|
64
|
-
should
|
64
|
+
should eql(other == object)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
@@ -17,7 +17,7 @@ describe Function::Binary, '#rename' do
|
|
17
17
|
let(:left) { attribute.eq(1) }
|
18
18
|
let(:right) { attribute.eq(2) }
|
19
19
|
|
20
|
-
it { should
|
20
|
+
it { should be_instance_of(described_class) }
|
21
21
|
|
22
22
|
its(:left) { should == other.eq(1) }
|
23
23
|
|
@@ -28,7 +28,7 @@ describe Function::Binary, '#rename' do
|
|
28
28
|
let(:left) { attribute.eq(1) }
|
29
29
|
let(:right) { other.eq(2) }
|
30
30
|
|
31
|
-
it { should
|
31
|
+
it { should be_instance_of(described_class) }
|
32
32
|
|
33
33
|
its(:left) { should == other.eq(1) }
|
34
34
|
|
@@ -39,7 +39,7 @@ describe Function::Binary, '#rename' do
|
|
39
39
|
let(:left) { other.eq(1) }
|
40
40
|
let(:right) { attribute.eq(2) }
|
41
41
|
|
42
|
-
it { should
|
42
|
+
it { should be_instance_of(described_class) }
|
43
43
|
|
44
44
|
its(:left) { should equal(left) }
|
45
45
|
|
@@ -12,7 +12,7 @@ describe Function::Connective::Conjunction, '#inverse' do
|
|
12
12
|
|
13
13
|
it_should_behave_like 'an idempotent method'
|
14
14
|
|
15
|
-
it { should
|
15
|
+
it { should be_instance_of(Function::Connective::Disjunction) }
|
16
16
|
|
17
17
|
its(:left) { should eql(Function::Connective::Negation.new(object.left)) }
|
18
18
|
|
@@ -12,7 +12,7 @@ describe Function::Connective::Disjunction, '#inverse' do
|
|
12
12
|
|
13
13
|
it_should_behave_like 'an idempotent method'
|
14
14
|
|
15
|
-
it { should
|
15
|
+
it { should be_instance_of(Function::Connective::Conjunction) }
|
16
16
|
|
17
17
|
its(:left) { should eql(Function::Connective::Negation.new(object.left)) }
|
18
18
|
|
@@ -19,7 +19,7 @@ require File.expand_path('../fixtures/classes', __FILE__)
|
|
19
19
|
context 'with no arguments' do
|
20
20
|
subject { object.send(method) }
|
21
21
|
|
22
|
-
it { should
|
22
|
+
it { should be_instance_of(Function::Connective::Negation) }
|
23
23
|
|
24
24
|
its(:operand) { should equal(object) }
|
25
25
|
end
|
@@ -29,7 +29,7 @@ require File.expand_path('../fixtures/classes', __FILE__)
|
|
29
29
|
|
30
30
|
let(:predicate) { Function::Predicate::Equality.new(header[:id], 1) }
|
31
31
|
|
32
|
-
it { should
|
32
|
+
it { should be_instance_of(Function::Connective::Conjunction) }
|
33
33
|
|
34
34
|
its(:left) { should equal(object) }
|
35
35
|
|
@@ -9,7 +9,7 @@ require 'spec_helper'
|
|
9
9
|
let(:described_class) { Class.new { include Function::Numeric::Absolute::Methods } }
|
10
10
|
let(:object) { described_class.new.freeze }
|
11
11
|
|
12
|
-
it { should
|
12
|
+
it { should be_instance_of(Function::Numeric::Absolute) }
|
13
13
|
|
14
14
|
its(:operand) { should equal(object) }
|
15
15
|
end
|
@@ -10,7 +10,7 @@ require 'spec_helper'
|
|
10
10
|
let(:object) { described_class.new.freeze }
|
11
11
|
let(:other) { mock('Other').freeze }
|
12
12
|
|
13
|
-
it { should
|
13
|
+
it { should be_instance_of(Function::Numeric::Addition) }
|
14
14
|
|
15
15
|
its(:left) { should equal(object) }
|
16
16
|
|
@@ -10,7 +10,7 @@ require 'spec_helper'
|
|
10
10
|
let(:object) { described_class.new.freeze }
|
11
11
|
let(:other) { mock('Other').freeze }
|
12
12
|
|
13
|
-
it { should
|
13
|
+
it { should be_instance_of(Function::Numeric::Division) }
|
14
14
|
|
15
15
|
its(:left) { should equal(object) }
|
16
16
|
|
@@ -11,7 +11,7 @@ describe Function::Numeric::Exponentiation, '#inverse' do
|
|
11
11
|
|
12
12
|
it_should_behave_like 'an idempotent method'
|
13
13
|
|
14
|
-
it { should
|
14
|
+
it { should be_instance_of(Function::Numeric::Exponentiation) }
|
15
15
|
|
16
16
|
its(:left) { should equal(left) }
|
17
17
|
its(:right) { should eql(Function::Numeric::Division.new(1, right)) }
|
@@ -10,7 +10,7 @@ require 'spec_helper'
|
|
10
10
|
let(:object) { described_class.new.freeze }
|
11
11
|
let(:other) { mock('Other').freeze }
|
12
12
|
|
13
|
-
it { should
|
13
|
+
it { should be_instance_of(Function::Numeric::Exponentiation) }
|
14
14
|
|
15
15
|
its(:left) { should equal(object) }
|
16
16
|
|
@@ -10,7 +10,7 @@ require 'spec_helper'
|
|
10
10
|
let(:object) { described_class.new.freeze }
|
11
11
|
let(:other) { mock('Other').freeze }
|
12
12
|
|
13
|
-
it { should
|
13
|
+
it { should be_instance_of(Function::Numeric::Modulo) }
|
14
14
|
|
15
15
|
its(:left) { should equal(object) }
|
16
16
|
|
@@ -10,7 +10,7 @@ require 'spec_helper'
|
|
10
10
|
let(:object) { described_class.new.freeze }
|
11
11
|
let(:other) { mock('Other').freeze }
|
12
12
|
|
13
|
-
it { should
|
13
|
+
it { should be_instance_of(Function::Numeric::Multiplication) }
|
14
14
|
|
15
15
|
its(:left) { should equal(object) }
|
16
16
|
|
@@ -9,7 +9,7 @@ require 'spec_helper'
|
|
9
9
|
let(:described_class) { Class.new { include Function::Numeric::SquareRoot::Methods } }
|
10
10
|
let(:object) { described_class.new.freeze }
|
11
11
|
|
12
|
-
it { should
|
12
|
+
it { should be_instance_of(Function::Numeric::SquareRoot) }
|
13
13
|
|
14
14
|
its(:operand) { should equal(object) }
|
15
15
|
end
|
@@ -10,7 +10,7 @@ require 'spec_helper'
|
|
10
10
|
let(:object) { described_class.new.freeze }
|
11
11
|
let(:other) { mock('Other').freeze }
|
12
12
|
|
13
|
-
it { should
|
13
|
+
it { should be_instance_of(Function::Numeric::Subtraction) }
|
14
14
|
|
15
15
|
its(:left) { should equal(object) }
|
16
16
|
|
@@ -9,7 +9,7 @@ require 'spec_helper'
|
|
9
9
|
let(:described_class) { Class.new { include Function::Numeric::UnaryMinus::Methods } }
|
10
10
|
let(:object) { described_class.new.freeze }
|
11
11
|
|
12
|
-
it { should
|
12
|
+
it { should be_instance_of(Function::Numeric::UnaryMinus) }
|
13
13
|
|
14
14
|
its(:operand) { should equal(object) }
|
15
15
|
end
|
@@ -9,7 +9,7 @@ require 'spec_helper'
|
|
9
9
|
let(:described_class) { Class.new { include Function::Numeric::UnaryPlus::Methods } }
|
10
10
|
let(:object) { described_class.new.freeze }
|
11
11
|
|
12
|
-
it { should
|
12
|
+
it { should be_instance_of(Function::Numeric::UnaryPlus) }
|
13
13
|
|
14
14
|
its(:operand) { should equal(object) }
|
15
15
|
end
|
@@ -16,7 +16,7 @@ describe Function::Predicate, '#eql?' do
|
|
16
16
|
it { should be(true) }
|
17
17
|
|
18
18
|
it 'is symmetric' do
|
19
|
-
should
|
19
|
+
should eql(other.eql?(object))
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -26,7 +26,7 @@ describe Function::Predicate, '#eql?' do
|
|
26
26
|
it { should be(true) }
|
27
27
|
|
28
28
|
it 'is symmetric' do
|
29
|
-
should
|
29
|
+
should eql(other.eql?(object))
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -36,7 +36,7 @@ describe Function::Predicate, '#eql?' do
|
|
36
36
|
it { should be(false) }
|
37
37
|
|
38
38
|
it 'is symmetric' do
|
39
|
-
should
|
39
|
+
should eql(other.eql?(object))
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -48,7 +48,7 @@ describe Function::Predicate, '#eql?' do
|
|
48
48
|
it { should be(false) }
|
49
49
|
|
50
50
|
it 'is symmetric' do
|
51
|
-
should
|
51
|
+
should eql(other.eql?(object))
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -60,7 +60,7 @@ describe Function::Predicate, '#eql?' do
|
|
60
60
|
it { should be(false) }
|
61
61
|
|
62
62
|
it 'is symmetric' do
|
63
|
-
should
|
63
|
+
should eql(other.eql?(object))
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
@@ -10,7 +10,7 @@ describe Function::Predicate::Equality, '#inverse' do
|
|
10
10
|
|
11
11
|
it_should_behave_like 'an idempotent method'
|
12
12
|
|
13
|
-
it { should
|
13
|
+
it { should be_instance_of(Function::Predicate::Inequality) }
|
14
14
|
|
15
15
|
its(:left) { should equal(attribute) }
|
16
16
|
|
@@ -11,7 +11,7 @@ describe Function::Predicate::Exclusion, '#inverse' do
|
|
11
11
|
|
12
12
|
it_should_behave_like 'an idempotent method'
|
13
13
|
|
14
|
-
it { should
|
14
|
+
it { should be_instance_of(Function::Predicate::Inclusion) }
|
15
15
|
|
16
16
|
its(:left) { should equal(attribute) }
|
17
17
|
|
@@ -10,5 +10,5 @@ describe Function::Predicate::Exclusion::Methods, '#exclude' do
|
|
10
10
|
let(:other) { [ true, false ] }
|
11
11
|
let(:object) { described_class.new }
|
12
12
|
|
13
|
-
it { should
|
13
|
+
it { should be_instance_of(Function::Predicate::Exclusion) }
|
14
14
|
end
|
@@ -10,7 +10,7 @@ describe Function::Predicate::GreaterThan, '#inverse' do
|
|
10
10
|
|
11
11
|
it_should_behave_like 'an idempotent method'
|
12
12
|
|
13
|
-
it { should
|
13
|
+
it { should be_instance_of(Function::Predicate::LessThanOrEqualTo) }
|
14
14
|
|
15
15
|
its(:left) { should equal(attribute) }
|
16
16
|
|
@@ -10,7 +10,7 @@ describe Function::Predicate::GreaterThanOrEqualTo, '#inverse' do
|
|
10
10
|
|
11
11
|
it_should_behave_like 'an idempotent method'
|
12
12
|
|
13
|
-
it { should
|
13
|
+
it { should be_instance_of(Function::Predicate::LessThan) }
|
14
14
|
|
15
15
|
its(:left) { should equal(attribute) }
|
16
16
|
|
@@ -10,5 +10,5 @@ describe Function::Predicate::GreaterThanOrEqualTo::Methods, '#gte' do
|
|
10
10
|
let(:other) { 1 }
|
11
11
|
let(:object) { described_class.new }
|
12
12
|
|
13
|
-
it { should
|
13
|
+
it { should be_instance_of(Function::Predicate::GreaterThanOrEqualTo) }
|
14
14
|
end
|
@@ -11,7 +11,7 @@ describe Function::Predicate::Inclusion, '#inverse' do
|
|
11
11
|
|
12
12
|
it_should_behave_like 'an idempotent method'
|
13
13
|
|
14
|
-
it { should
|
14
|
+
it { should be_instance_of(Function::Predicate::Exclusion) }
|
15
15
|
|
16
16
|
its(:left) { should equal(attribute) }
|
17
17
|
|
@@ -10,5 +10,5 @@ describe Function::Predicate::Inclusion::Methods, '#include' do
|
|
10
10
|
let(:other) { [ true, false ] }
|
11
11
|
let(:object) { described_class.new }
|
12
12
|
|
13
|
-
it { should
|
13
|
+
it { should be_instance_of(Function::Predicate::Inclusion) }
|
14
14
|
end
|
@@ -10,7 +10,7 @@ describe Function::Predicate::Inequality, '#inverse' do
|
|
10
10
|
|
11
11
|
it_should_behave_like 'an idempotent method'
|
12
12
|
|
13
|
-
it { should
|
13
|
+
it { should be_instance_of(Function::Predicate::Equality) }
|
14
14
|
|
15
15
|
its(:left) { should equal(attribute) }
|
16
16
|
|
@@ -8,7 +8,7 @@ describe Function::Predicate, '#inverse' do
|
|
8
8
|
|
9
9
|
let(:object) { described_class.new(1, 1) }
|
10
10
|
|
11
|
-
|
11
|
+
specify { expect { subject }.to raise_error(NoMethodError) }
|
12
12
|
|
13
13
|
it 'calls the class inverse method' do
|
14
14
|
described_class.should_receive(:inverse).and_return(described_class)
|
@@ -10,7 +10,7 @@ describe Function::Predicate::LessThan, '#inverse' do
|
|
10
10
|
|
11
11
|
it_should_behave_like 'an idempotent method'
|
12
12
|
|
13
|
-
it { should
|
13
|
+
it { should be_instance_of(Function::Predicate::GreaterThanOrEqualTo) }
|
14
14
|
|
15
15
|
its(:left) { should equal(attribute) }
|
16
16
|
|
@@ -10,7 +10,7 @@ describe Function::Predicate::LessThanOrEqualTo, '#inverse' do
|
|
10
10
|
|
11
11
|
it_should_behave_like 'an idempotent method'
|
12
12
|
|
13
|
-
it { should
|
13
|
+
it { should be_instance_of(Function::Predicate::GreaterThan) }
|
14
14
|
|
15
15
|
its(:left) { should equal(attribute) }
|
16
16
|
|
@@ -10,5 +10,5 @@ describe Function::Predicate::LessThanOrEqualTo::Methods, '#lte' do
|
|
10
10
|
let(:other) { 1 }
|
11
11
|
let(:object) { described_class.new }
|
12
12
|
|
13
|
-
it { should
|
13
|
+
it { should be_instance_of(Function::Predicate::LessThanOrEqualTo) }
|
14
14
|
end
|
@@ -11,7 +11,7 @@ describe Function::Predicate::Match, '#inverse' do
|
|
11
11
|
|
12
12
|
it_should_behave_like 'an idempotent method'
|
13
13
|
|
14
|
-
it { should
|
14
|
+
it { should be_instance_of(Function::Predicate::NoMatch) }
|
15
15
|
|
16
16
|
its(:left) { should equal(attribute) }
|
17
17
|
|
@@ -11,7 +11,7 @@ describe Function::Predicate::NoMatch, '#inverse' do
|
|
11
11
|
|
12
12
|
it_should_behave_like 'an idempotent method'
|
13
13
|
|
14
|
-
it { should
|
14
|
+
it { should be_instance_of(Function::Predicate::Match) }
|
15
15
|
|
16
16
|
its(:left) { should equal(attribute) }
|
17
17
|
|
@@ -14,7 +14,7 @@ describe Function::Proposition, '#eql?' do
|
|
14
14
|
it { should be(true) }
|
15
15
|
|
16
16
|
it 'is symmetric' do
|
17
|
-
should
|
17
|
+
should eql(other.eql?(object))
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -24,7 +24,7 @@ describe Function::Proposition, '#eql?' do
|
|
24
24
|
it { should be(false) }
|
25
25
|
|
26
26
|
it 'is symmetric' do
|
27
|
-
should
|
27
|
+
should eql(other.eql?(object))
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -34,7 +34,7 @@ describe Function::Proposition, '#eql?' do
|
|
34
34
|
it { should be(false) }
|
35
35
|
|
36
36
|
it 'is symmetric' do
|
37
|
-
should
|
37
|
+
should eql(other.eql?(object))
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
@@ -14,7 +14,7 @@ describe Function::Proposition, '#==' do
|
|
14
14
|
it { should be(true) }
|
15
15
|
|
16
16
|
it 'is symmetric' do
|
17
|
-
should
|
17
|
+
should eql(other == object)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -24,7 +24,7 @@ describe Function::Proposition, '#==' do
|
|
24
24
|
it { should be(true) }
|
25
25
|
|
26
26
|
it 'is symmetric' do
|
27
|
-
should
|
27
|
+
should eql(other == object)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -34,7 +34,7 @@ describe Function::Proposition, '#==' do
|
|
34
34
|
it { should be(false) }
|
35
35
|
|
36
36
|
it 'is symmetric' do
|
37
|
-
should
|
37
|
+
should eql(other == object)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
@@ -8,7 +8,7 @@ describe Function::String::Length::Methods, '#length' do
|
|
8
8
|
let(:described_class) { Class.new { include Function::String::Length::Methods } }
|
9
9
|
let(:object) { described_class.new.freeze }
|
10
10
|
|
11
|
-
it { should
|
11
|
+
it { should be_instance_of(Function::String::Length) }
|
12
12
|
|
13
13
|
its(:operand) { should equal(object) }
|
14
14
|
end
|
@@ -18,7 +18,7 @@ describe Function::Unary, '#==' do
|
|
18
18
|
it { should be(true) }
|
19
19
|
|
20
20
|
it 'is symmetric' do
|
21
|
-
should
|
21
|
+
should eql(other == object)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -28,7 +28,7 @@ describe Function::Unary, '#==' do
|
|
28
28
|
it { should be(true) }
|
29
29
|
|
30
30
|
it 'is symmetric' do
|
31
|
-
should
|
31
|
+
should eql(other == object)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -38,7 +38,7 @@ describe Function::Unary, '#==' do
|
|
38
38
|
it { should be(true) }
|
39
39
|
|
40
40
|
it 'is symmetric' do
|
41
|
-
should
|
41
|
+
should eql(other == object)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -49,7 +49,7 @@ describe Function::Unary, '#==' do
|
|
49
49
|
it { should be(false) }
|
50
50
|
|
51
51
|
it 'is symmetric' do
|
52
|
-
should
|
52
|
+
should eql(other == object)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -16,7 +16,7 @@ describe Function::Unary, '#rename' do
|
|
16
16
|
context 'operand is renamed' do
|
17
17
|
let(:operand) { attribute.eq(1) }
|
18
18
|
|
19
|
-
it { should
|
19
|
+
it { should be_instance_of(described_class) }
|
20
20
|
|
21
21
|
its(:operand) { should eql(other.eq(1)) }
|
22
22
|
end
|
@@ -31,6 +31,12 @@ describe Immutable, '.freeze_object' do
|
|
31
31
|
it { should equal(value) }
|
32
32
|
end
|
33
33
|
|
34
|
+
context 'with a symbol value' do
|
35
|
+
let(:value) { :symbol }
|
36
|
+
|
37
|
+
it { should equal(value) }
|
38
|
+
end
|
39
|
+
|
34
40
|
context 'with a frozen value' do
|
35
41
|
let(:value) { String.new.freeze }
|
36
42
|
|
@@ -42,7 +48,7 @@ describe Immutable, '.freeze_object' do
|
|
42
48
|
|
43
49
|
it { should_not equal(value) }
|
44
50
|
|
45
|
-
it { should
|
51
|
+
it { should be_instance_of(String) }
|
46
52
|
|
47
53
|
it { should == value }
|
48
54
|
|