veritas 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +10 -4
- data/Gemfile +1 -1
- data/TODO +10 -0
- data/config/flay.yml +1 -1
- data/config/flog.yml +1 -1
- data/config/roodi.yml +2 -2
- data/config/site.reek +2 -1
- data/lib/veritas.rb +2 -2
- data/lib/veritas/algebra/join.rb +13 -91
- data/lib/veritas/algebra/product.rb +4 -1
- data/lib/veritas/attribute.rb +1 -1
- data/lib/veritas/function/connective/negation.rb +13 -1
- data/lib/veritas/function/numeric/absolute.rb +5 -19
- data/lib/veritas/function/numeric/unary.rb +3 -0
- data/lib/veritas/function/numeric/unary_minus.rb +5 -19
- data/lib/veritas/function/numeric/unary_plus.rb +5 -21
- data/lib/veritas/function/proposition.rb +3 -28
- data/lib/veritas/function/string/length.rb +0 -1
- data/lib/veritas/function/unary.rb +47 -0
- data/lib/veritas/relation.rb +16 -2
- data/lib/veritas/relation/header.rb +48 -41
- data/lib/veritas/relation/operation/order/direction.rb +13 -1
- data/lib/veritas/relation/operation/order/direction_set.rb +9 -198
- data/lib/veritas/relation/operation/reverse.rb +0 -2
- data/lib/veritas/support/comparator.rb +1 -1
- data/lib/veritas/support/evaluator.rb +3 -0
- data/lib/veritas/support/immutable.rb +33 -8
- data/lib/veritas/tuple.rb +8 -6
- data/lib/veritas/version.rb +1 -1
- data/spec/integration/veritas/algebra/projection_spec.rb +1 -1
- data/spec/integration/veritas/relation/efficient_enumerable_spec.rb +40 -15
- data/spec/rcov.opts +1 -0
- data/spec/shared/hash_method_behavior.rb +10 -5
- data/spec/spec_helper.rb +1 -1
- data/spec/unit/veritas/algebra/extension/class_methods/new_spec.rb +1 -1
- data/spec/unit/veritas/algebra/join/class_methods/new_spec.rb +1 -1
- data/spec/unit/veritas/algebra/join/each_spec.rb +36 -9
- data/spec/unit/veritas/aliasable/inheritable_alias_spec.rb +1 -1
- data/spec/unit/veritas/comparator/compare_spec.rb +4 -1
- data/spec/unit/veritas/evaluator/context/method_missing_spec.rb +7 -1
- data/spec/unit/veritas/function/connective/negation/class_methods/operation_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/absolute/class_methods/operation_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/unary_minus/class_methods/operation_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/unary_plus/class_methods/operation_spec.rb +11 -0
- data/spec/unit/veritas/function/unary/callable/call_spec.rb +23 -0
- data/spec/unit/veritas/function/unary/callable/included_spec.rb +23 -0
- data/spec/unit/veritas/function/unary/inspect_spec.rb +34 -0
- data/spec/unit/veritas/immutable/fixtures/classes.rb +3 -3
- data/spec/unit/veritas/immutable/module_methods/memoize_spec.rb +20 -10
- data/spec/unit/veritas/relation/class_methods/coerce_spec.rb +23 -0
- data/spec/unit/veritas/relation/each_spec.rb +1 -1
- data/spec/unit/veritas/relation/equal_value_spec.rb +12 -0
- data/spec/unit/veritas/relation/header/call_spec.rb +23 -0
- 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/each_spec.rb +1 -1
- data/spec/unit/veritas/relation/header/empty_spec.rb +5 -4
- data/spec/unit/veritas/relation/header/intersect_spec.rb +18 -4
- data/spec/unit/veritas/relation/operation/binary/class_methods/new_spec.rb +25 -25
- data/spec/unit/veritas/relation/operation/order/direction/name_spec.rb +13 -0
- data/spec/unit/veritas/relation/operation/order/direction_set/class_methods/new_spec.rb +1 -1
- data/spec/unit/veritas/relation/operation/order/direction_set/equal_value_spec.rb +13 -0
- data/spec/unit/veritas/tuple/call_spec.rb +25 -0
- data/spec/unit/veritas/tuple/class_methods/coerce_spec.rb +1 -1
- data/tasks/metrics/ci.rake +2 -2
- data/tasks/metrics/flay.rake +1 -1
- data/tasks/metrics/flog.rake +5 -3
- data/tasks/metrics/heckle.rake +18 -11
- data/tasks/metrics/reek.rake +1 -1
- data/tasks/spec.rake +23 -14
- data/veritas.gemspec +14 -8
- metadata +31 -25
- data/spec/unit/veritas/relation/header/element_reference_spec.rb +0 -21
- data/spec/unit/veritas/relation/operation/order/direction_set/each_spec.rb +0 -32
- data/spec/unit/veritas/relation/operation/order/direction_set/empty_spec.rb +0 -21
- data/spec/unit/veritas/relation/operation/order/direction_set/union_spec.rb +0 -18
- data/spec/unit/veritas/tuple/element_reference_spec.rb +0 -22
@@ -1,21 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Relation::Header, '#[]' do
|
6
|
-
subject { object[name] }
|
7
|
-
|
8
|
-
let(:object) { described_class.new([ [ :id, Integer ] ]) }
|
9
|
-
|
10
|
-
context 'with a known attribute name' do
|
11
|
-
let(:name) { :id }
|
12
|
-
|
13
|
-
it { should == [ :id, Integer ] }
|
14
|
-
end
|
15
|
-
|
16
|
-
context 'with an unknown attribute name' do
|
17
|
-
let(:name) { :name }
|
18
|
-
|
19
|
-
it { should be_nil }
|
20
|
-
end
|
21
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Relation::Operation::Order::DirectionSet, '#each' do
|
6
|
-
subject { object.each { |direction| yields << direction } }
|
7
|
-
|
8
|
-
let(:attributes) { [ Attribute::Integer.new(:id), Attribute::String.new(:name) ] }
|
9
|
-
let(:object) { described_class.new(attributes) }
|
10
|
-
let(:yields) { [] }
|
11
|
-
|
12
|
-
it_should_behave_like 'an #each method'
|
13
|
-
|
14
|
-
it 'yields each direction' do
|
15
|
-
expect { subject }.to change { yields.dup }.
|
16
|
-
from([]).
|
17
|
-
to(attributes.map { |attribute| attribute.asc })
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe Relation::Operation::Order::DirectionSet do
|
22
|
-
subject { object.new(attributes) }
|
23
|
-
|
24
|
-
let(:attributes) { [ Attribute::Integer.new(:id) ] }
|
25
|
-
let(:object) { Relation::Operation::Order::DirectionSet }
|
26
|
-
|
27
|
-
it { should be_kind_of(Enumerable) }
|
28
|
-
|
29
|
-
it 'case matches Enumerable' do
|
30
|
-
(Enumerable === subject).should be(true)
|
31
|
-
end
|
32
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Relation::Operation::Order::DirectionSet, '#empty?' do
|
6
|
-
subject { object.empty? }
|
7
|
-
|
8
|
-
let(:object) { described_class.new(attributes) }
|
9
|
-
|
10
|
-
context 'with an empty set' do
|
11
|
-
let(:attributes) { [] }
|
12
|
-
|
13
|
-
it { should be(true) }
|
14
|
-
end
|
15
|
-
|
16
|
-
context 'with directions' do
|
17
|
-
let(:attributes) { [ Attribute::Integer.new(:id) ] }
|
18
|
-
|
19
|
-
it { should be(false) }
|
20
|
-
end
|
21
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
[ :union, :| ].each do |method|
|
6
|
-
describe Relation::Operation::Order::DirectionSet, "##{method}" do
|
7
|
-
subject { object.send(method, other) }
|
8
|
-
|
9
|
-
let(:attribute1) { Attribute::Integer.new(:id) }
|
10
|
-
let(:attribute2) { Attribute::String.new(:name) }
|
11
|
-
let(:object) { described_class.new([ attribute1 ]) }
|
12
|
-
let(:other) { described_class.new([ attribute2 ]) }
|
13
|
-
|
14
|
-
it { should be_instance_of(described_class) }
|
15
|
-
|
16
|
-
it { should == [ attribute1.asc, attribute2.asc ] }
|
17
|
-
end
|
18
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Tuple, '#[]' do
|
6
|
-
subject { object[attribute] }
|
7
|
-
|
8
|
-
let(:header) { Relation::Header.new([ [ :id, Integer ] ]) }
|
9
|
-
let(:object) { described_class.new(header, [ 1 ]) }
|
10
|
-
|
11
|
-
context 'with a known attribute' do
|
12
|
-
let(:attribute) { header[:id] }
|
13
|
-
|
14
|
-
it { should == 1 }
|
15
|
-
end
|
16
|
-
|
17
|
-
context 'with an unknown attribute' do
|
18
|
-
let(:attribute) { Attribute::Integer.new(:other_id) }
|
19
|
-
|
20
|
-
specify { expect { subject }.to raise_error(IndexError) }
|
21
|
-
end
|
22
|
-
end
|