source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/rank/test_heading.rb | Ruby | mit | 49 | master | 436 | require 'spec_helper'
module Alf
module Algebra
describe Rank, 'heading' do
let(:operand){
an_operand.with_heading(:id => Integer, :name => String)
}
let(:op){
a_lispy.rank(operand, [[:name, :asc]], :rank)
}
subject{ op.heading }
let(:expected){
Head... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/rank/test_type_check.rb | Ruby | mit | 49 | master | 876 | require 'type_check_helper'
module Alf
module Algebra
describe Rank, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
rank(suppliers, [[:name, :asc]], :rank)
}
it{ should eq(op.heading) }
end
context 'when invalid ordering' do
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/clip/test_keys.rb | Ruby | mit | 49 | master | 1,003 | require 'spec_helper'
module Alf
module Algebra
describe Clip, 'keys' do
let(:operand){
an_operand.with_heading(:id => Integer, :name => String, :status => String).
with_keys([:id], [:name])
}
subject{ op.keys }
context 'when conserving at least one key' do
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/clip/test_type_check.rb | Ruby | mit | 49 | master | 903 | require 'type_check_helper'
module Alf
module Algebra
describe Clip, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
clip(suppliers, [:sid, :name])
}
it{ should eq(op.heading) }
end
context 'when clipping unexisting attribute' ... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/clip/test_heading.rb | Ruby | mit | 49 | master | 668 | require 'spec_helper'
module Alf
module Algebra
describe Clip, 'heading' do
let(:operand){
an_operand.with_heading(:id => Integer, :name => String)
}
subject{ op.heading }
context '-no-allbut' do
let(:op){
a_lispy.clip(operand, [:id])
}
let(:ex... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/hierarchize/test_heading.rb | Ruby | mit | 49 | master | 445 | require 'spec_helper'
module Alf
module Algebra
describe Hierarchize, "heading" do
let(:base){
{id: Integer, parent: Integer, city: String}
}
let(:operand){
an_operand.with_heading(base)
}
let(:op){
a_lispy.hierarchize(operand, :id, :parent, :as)
}
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/hierarchize/test_type_check.rb | Ruby | mit | 49 | master | 1,255 | require 'type_check_helper'
module Alf
module Algebra
describe Hierarchize, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
hierarchize(supplies, [:sid], [:pid], :children)
}
it{ should eq(op.heading) }
end
context 'when no suc... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/commons/test_to_ascii_tree.rb | Ruby | mit | 49 | master | 963 | require 'spec_helper'
module Alf
module Algebra
describe Operator, "to_ascii_tree" do
subject{ operator.to_ascii_tree }
context 'on an unary operator' do
let(:operator){
project(suppliers, [:sid, :name])
}
it 'returns the expected tree' do
subject.should ... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/commons/test_resulting_type.rb | Ruby | mit | 49 | master | 403 | require 'spec_helper'
module Alf
module Algebra
describe Operator, "resulting_type" do
subject{ operator.resulting_type }
context 'on an unary operator' do
let(:operator){
project(suppliers, [:sid, :name])
}
it 'returns the expected type' do
subject.shoul... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/commons/test_with_operands.rb | Ruby | mit | 49 | master | 1,197 | require 'spec_helper'
module Alf
module Algebra
describe Operator, "with_operands" do
let(:operand_1) { an_operand.with_heading(:id => Integer).with_keys([:id]) }
let(:operand_2) { an_operand.with_heading(:name => String).with_keys([:name]) }
let(:operator) { a_lispy.project(operand_1, [:fo... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/wrap/test_type_check.rb | Ruby | mit | 49 | master | 1,085 | require 'type_check_helper'
module Alf
module Algebra
describe Wrap, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
wrap(suppliers, [:status, :city], :extra)
}
it{ should eq(op.heading) }
end
context 'when ok (allowed overridi... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/wrap/test_keys.rb | Ruby | mit | 49 | master | 1,141 | require 'spec_helper'
module Alf
module Algebra
describe Wrap, 'wrap' do
subject{ op.keys }
let(:operand){
an_operand.with_heading(:id => Integer, :name => String).with_keys([:id])
}
context 'when no key is wrapped' do
let(:op){
a_lispy.wrap(operand, [:name], ... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/wrap/test_heading.rb | Ruby | mit | 49 | master | 627 | require 'spec_helper'
module Alf
module Algebra
describe Wrap, 'heading' do
let(:operand){
an_operand.with_heading(id: Integer, name: String)
}
let(:expected){
Heading[id: Integer, names: Tuple[name: String]]
}
subject{ op.heading }
context '--no-allbut' do
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/coerce/test_type_check.rb | Ruby | mit | 49 | master | 919 | require 'type_check_helper'
module Alf
module Algebra
describe Coerce, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
coerce(suppliers, sid: Float)
}
it{ should eq(op.heading) }
end
context 'when unexisting attribute' do
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/coerce/test_heading.rb | Ruby | mit | 49 | master | 413 | require 'spec_helper'
module Alf
module Algebra
describe Coerce, 'heading' do
let(:operand){
an_operand.with_heading(:id => String, :name => String)
}
subject{ op.heading }
let(:op){
a_lispy.coerce(operand, :id => Integer)
}
let(:expected){
Heading[:... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/coerce/test_keys.rb | Ruby | mit | 49 | master | 352 | require 'spec_helper'
module Alf
module Algebra
describe Coerce, 'keys' do
let(:operand){
an_operand.with_keys([:id])
}
subject{ op.keys }
let(:op){
a_lispy.coerce(operand, :id => Integer)
}
let(:expected){
Keys[ [:id] ]
}
it { should eq... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/not_matching/test_type_check.rb | Ruby | mit | 49 | master | 1,329 | require 'type_check_helper'
module Alf
module Algebra
describe NotMatching, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
not_matching(suppliers, suppliers)
}
it{ should eq(op.heading) }
end
context 'when nothing in common' d... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/not_matching/test_keys.rb | Ruby | mit | 49 | master | 484 | require 'spec_helper'
module Alf
module Algebra
describe NotMatching, 'keys' do
let(:left){
an_operand.with_heading(:id => Fixnum, :name => String).with_keys([:id])
}
let(:right){
an_operand.with_heading(:id => Integer, :foo => String)
}
let(:op){
a_lispy.n... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/not_matching/test_heading.rb | Ruby | mit | 49 | master | 499 | require 'spec_helper'
module Alf
module Algebra
describe NotMatching, 'heading' do
let(:left){
an_operand.with_heading(:id => Fixnum, :name => String)
}
let(:right){
an_operand.with_heading(:id => Integer, :foo => String)
}
let(:op){
a_lispy.not_matching(le... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/image/test_keys.rb | Ruby | mit | 49 | master | 252 | require 'spec_helper'
module Alf
module Algebra
describe Image, 'keys' do
subject{ op.keys }
let(:op){
a_lispy.image(suppliers, supplies, :supplying)
}
it{ should eq(Keys[[:sid], [:name]]) }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/image/test_type_check.rb | Ruby | mit | 49 | master | 586 | require 'type_check_helper'
module Alf
module Algebra
describe Image, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
image(suppliers, supplies, :supplying)
}
it{ should eq(op.heading) }
end
context 'when diasllowed overriding'... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/image/test_heading.rb | Ruby | mit | 49 | master | 462 | require 'spec_helper'
module Alf
module Algebra
describe Image, 'heading' do
subject{ op.heading }
let(:op){
a_lispy.image(suppliers, supplies, :supplying)
}
let(:expected){
Heading[sid: String,
name: String,
status: Integer,
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/frame/test_type_check.rb | Ruby | mit | 49 | master | 1,188 | require 'type_check_helper'
module Alf
module Algebra
describe Frame, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
frame(suppliers, [], 2, 4)
}
it{ should eq(op.heading) }
end
context 'when invalid ordering' do
let(:... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/quota/test_heading.rb | Ruby | mit | 49 | master | 463 | require 'spec_helper'
module Alf
module Algebra
describe Quota, 'heading' do
let(:operand){
an_operand.with_heading(:id => Integer, :name => String)
}
let(:op){
a_lispy.quota(operand, [:id], [[:name, :asc]], :sum => a_lispy.sum{ id })
}
subject{ op.heading }
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/quota/test_keys.rb | Ruby | mit | 49 | master | 435 | require 'spec_helper'
module Alf
module Algebra
describe Quota, 'keys' do
let(:operand){
an_operand.with_heading(:id => Integer, :name => String).with_keys([ :id ])
}
let(:op){
a_lispy.quota(operand, [:id], [[:name, :asc]], :sum => a_lispy.sum{ id })
}
subject{ op.... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/quota/test_type_check.rb | Ruby | mit | 49 | master | 1,245 | require 'type_check_helper'
module Alf
module Algebra
describe Quota, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
quota(supplies, [:sid], [[:sid, :asc]], :sum => sum{ qty })
}
it{ should eq(op.heading) }
end
context 'when u... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/group/test_keys.rb | Ruby | mit | 49 | master | 1,593 | require 'spec_helper'
module Alf
module Algebra
describe Group, 'keys' do
subject{ op.keys }
context 'when keys are not split by the group' do
let(:operand){
an_operand.with_heading(:id => Integer, :name => String).
with_keys([ :id ])
}
context... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/group/test_type_check.rb | Ruby | mit | 49 | master | 1,090 | require 'type_check_helper'
module Alf
module Algebra
describe Group, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
group(suppliers, [:status, :city], :extra)
}
it{ should eq(op.heading) }
end
context 'when ok (allowed overri... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/group/test_heading.rb | Ruby | mit | 49 | master | 634 | require 'spec_helper'
module Alf
module Algebra
describe Group, 'heading' do
let(:operand){
an_operand.with_heading(id: Integer, name: String)
}
let(:expected){
Heading[id: Integer, names: Relation[name: String] ]
}
subject{ op.heading }
context '--no-allbut'... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/extend/test_heading.rb | Ruby | mit | 49 | master | 1,098 | require 'spec_helper'
module Alf
module Algebra
describe Extend, 'heading' do
let(:operand){
an_operand.with_heading(:name => String)
}
let(:op){
a_lispy.extend(operand, :computed => lambda{ 12 })
}
subject{ op.heading }
context 'with proper expression analys... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/extend/test_keys.rb | Ruby | mit | 49 | master | 676 | require 'spec_helper'
module Alf
module Algebra
describe Extend, 'keys' do
let(:operand){
an_operand.with_heading(:id => Integer, :name => String).
with_keys([ :id ], [ :name ])
}
subject{ op.keys }
context "when no key is touched by extensions" do
let(... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/extend/test_type_check.rb | Ruby | mit | 49 | master | 892 | require 'type_check_helper'
module Alf
module Algebra
describe Extend, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
extend(suppliers, foo: 12)
}
it{ should eq(op.heading) }
end
context 'when clash attribute' do
let(:... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/minus/test_type_check.rb | Ruby | mit | 49 | master | 559 | require 'type_check_helper'
module Alf
module Algebra
describe Minus, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
minus(suppliers, suppliers)
}
it{ should eq(op.heading) }
end
context 'when heading mismatch' do
let(... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/minus/test_keys.rb | Ruby | mit | 49 | master | 474 | require 'spec_helper'
module Alf
module Algebra
describe Minus, 'keys' do
let(:left){
an_operand.with_heading(:id => Fixnum, :name => String).with_keys([ :id ])
}
let(:right){
an_operand.with_heading(:id => Integer, :name => String)
}
let(:op){
a_lispy.minu... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/minus/test_heading.rb | Ruby | mit | 49 | master | 487 | require 'spec_helper'
module Alf
module Algebra
describe Minus, 'heading' do
let(:left){
an_operand.with_heading(:id => Fixnum, :name => String)
}
let(:right){
an_operand.with_heading(:id => Integer, :name => String)
}
let(:op){
a_lispy.minus(left, right)
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/compact/test_keys.rb | Ruby | mit | 49 | master | 773 | require 'spec_helper'
module Alf
module Algebra
describe Compact, 'keys' do
subject{ op.keys }
let(:op){
a_lispy.compact(operand)
}
context 'when the operand has a key' do
let(:operand){
an_operand.with_heading(:id => String, :name => String).
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/compact/test_heading.rb | Ruby | mit | 49 | master | 398 | require 'spec_helper'
module Alf
module Algebra
describe Compact, 'heading' do
let(:operand){
an_operand.with_heading(:id => String, :name => String)
}
subject{ op.heading }
let(:op){
a_lispy.compact(operand)
}
let(:expected){
Heading[:id => String, ... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/restrict/test_type_check.rb | Ruby | mit | 49 | master | 1,055 | require 'type_check_helper'
module Alf
module Algebra
describe Restrict, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
restrict(suppliers, city: 'London')
}
it{ should eq(op.heading) }
end
context 'when no such attribute' do
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/restrict/test_heading.rb | Ruby | mit | 49 | master | 416 | require 'spec_helper'
module Alf
module Algebra
describe Restrict, 'heading' do
let(:operand){
an_operand.with_heading(:id => Fixnum, :name => String)
}
let(:op){
a_lispy.restrict(operand, lambda{ true })
}
subject{ op.heading }
let(:expected){
Headi... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/restrict/test_keys.rb | Ruby | mit | 49 | master | 1,217 | require 'spec_helper'
module Alf
module Algebra
describe Restrict, 'keys' do
subject{ op.keys }
context 'when the restriction does not touches existing keys' do
let(:operand){
an_operand.with_heading(id: Fixnum, name: String).with_keys([:id])
}
let(:op){
a... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/autonum/test_heading.rb | Ruby | mit | 49 | master | 392 | require 'spec_helper'
module Alf
module Algebra
describe Autonum, 'heading' do
let(:operand){
an_operand.with_heading(:name => String)
}
let(:op){
a_lispy.autonum(operand, :auto)
}
let(:expected){
Heading[:auto => Integer, :name => String]
}
sub... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/autonum/test_type_check.rb | Ruby | mit | 49 | master | 558 | require 'type_check_helper'
module Alf
module Algebra
describe Autonum, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
autonum(suppliers, :auto)
}
it{ should eq(op.heading) }
end
context 'when name clash' do
let(:op){ ... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/autonum/test_keys.rb | Ruby | mit | 49 | master | 358 | require 'spec_helper'
module Alf
module Algebra
describe Autonum, 'heading' do
let(:operand){
an_operand.with_keys([:name])
}
let(:op){
a_lispy.autonum(operand, :auto)
}
let(:expected){
Keys[[:name], [:auto]]
}
subject{ op.keys }
it { sho... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/intersect/test_keys.rb | Ruby | mit | 49 | master | 1,679 | require 'spec_helper'
module Alf
module Algebra
describe Intersect, 'keys' do
let(:left){
an_operand.with_heading(:id => Integer, :name => String).
with_keys([ :id ])
}
subject{ op.keys }
context 'when exactly same keys' do
let(:right){
an_op... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/intersect/test_type_check.rb | Ruby | mit | 49 | master | 571 | require 'type_check_helper'
module Alf
module Algebra
describe Intersect, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
intersect(suppliers, suppliers)
}
it{ should eq(op.heading) }
end
context 'when heading mismatch' do
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/intersect/test_heading.rb | Ruby | mit | 49 | master | 818 | require 'spec_helper'
module Alf
module Algebra
describe Intersect, 'heading' do
let(:left){
an_operand.with_heading(:id => Integer, :name => String)
}
let(:expected){
Heading[:id => Integer, :name => String]
}
subject{ op.heading }
context 'when exactly same... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/allbut/test_keys.rb | Ruby | mit | 49 | master | 1,171 | require 'spec_helper'
module Alf
module Algebra
describe Allbut, 'keys' do
let(:operand){
an_operand.with_heading(id: Integer, name: String, status: String).
with_keys([:id], [:name])
}
subject{ op.keys }
context 'when conserving at least one key' do
l... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/allbut/test_type_check.rb | Ruby | mit | 49 | master | 915 | require 'type_check_helper'
module Alf
module Algebra
describe Allbut, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
allbut(suppliers, [:sid, :name])
}
it{ should eq(op.heading) }
end
context 'when projecting unexisting attri... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/allbut/test_key_preserving.rb | Ruby | mit | 49 | master | 1,331 | require 'spec_helper'
module Alf
module Algebra
describe Allbut, 'key_preserving?' do
let(:operand){
an_operand.with_heading(:id => Integer, :name => String, :status => String).
with_keys([:id], [:name])
}
subject{ op.key_preserving? }
context 'when conserving... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/generator/test_keys.rb | Ruby | mit | 49 | master | 282 | require 'spec_helper'
module Alf
module Algebra
describe Generator, 'keys' do
subject{ op.keys }
let(:op){
a_lispy.generator(10, :auto)
}
let(:expected){
Keys[ [ :auto ] ]
}
it { should eq(expected) }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/generator/test_heading.rb | Ruby | mit | 49 | master | 296 | require 'spec_helper'
module Alf
module Algebra
describe Generator, 'heading' do
subject{ op.heading }
let(:op){
a_lispy.generator(10, :auto)
}
let(:expected){
Heading[:auto => Integer]
}
it { should eq(expected) }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/project/test_type_check.rb | Ruby | mit | 49 | master | 921 | require 'type_check_helper'
module Alf
module Algebra
describe Project, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
project(suppliers, [:sid, :name])
}
it{ should eq(op.heading) }
end
context 'when projectping unexisting at... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/project/test_keys.rb | Ruby | mit | 49 | master | 2,139 | require 'spec_helper'
module Alf
module Algebra
describe Project, 'keys' do
subject{ op.keys }
context 'with two single keys' do
let(:operand){
an_operand.with_heading(id: Integer, name: String, status: String, city: String).
with_keys([:id], [:name])
}... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/project/test_heading.rb | Ruby | mit | 49 | master | 677 | require 'spec_helper'
module Alf
module Algebra
describe Project, 'heading' do
let(:operand){
an_operand.with_heading(:id => Integer, :name => String)
}
subject{ op.heading }
context '-no-allbut' do
let(:op){
a_lispy.project(operand, [:id])
}
l... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/project/test_key_preserving.rb | Ruby | mit | 49 | master | 1,402 | require 'spec_helper'
module Alf
module Algebra
describe Project, 'key_preserving?' do
let(:operand){
an_operand.with_heading(:id => Integer, :name => String, :status => String).
with_keys([:id], [:name])
}
subject{ op.key_preserving? }
context 'when conservin... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/unwrap/test_keys.rb | Ruby | mit | 49 | master | 351 | require 'spec_helper'
module Alf
module Algebra
describe Unwrap, "keys" do
let(:operand){
an_operand.with_heading(:id => Integer, :names => Hash).with_keys([:id])
}
let(:op){
a_lispy.unwrap(operand, :names)
}
subject{ op.keys }
it{
should eq(Keys[ [:id... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/unwrap/test_type_check.rb | Ruby | mit | 49 | master | 1,002 | require 'type_check_helper'
module Alf
module Algebra
describe Unwrap, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
unwrap(wrap(suppliers, [:status, :city], :extra), :extra)
}
it{ should eq(op.heading) }
end
context 'when no... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/unwrap/test_heading.rb | Ruby | mit | 49 | master | 407 | require 'spec_helper'
module Alf
module Algebra
describe Unwrap, "heading" do
let(:operand){
an_operand.with_heading(id: Integer, names: Tuple[name: String, status: Integer])
}
let(:op){
a_lispy.unwrap(operand, :names)
}
subject{ op.heading }
it{
should... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/sort/test_keys.rb | Ruby | mit | 49 | master | 416 | require 'spec_helper'
module Alf
module Algebra
describe Sort, 'keys' do
let(:operand){
an_operand.with_heading(:id => Integer, :name => String).
with_keys([ :id ])
}
subject{ op.keys }
let(:op){
a_lispy.sort(operand, [:id, :desc])
}
let(:... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/sort/test_heading.rb | Ruby | mit | 49 | master | 408 | require 'spec_helper'
module Alf
module Algebra
describe Sort, 'heading' do
let(:operand){
an_operand.with_heading(:id => Integer, :name => String)
}
subject{ op.heading }
let(:op){
a_lispy.sort(operand, [:id, :desc])
}
let(:expected){
Heading[:id =>... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/sort/test_type_check.rb | Ruby | mit | 49 | master | 572 | require 'type_check_helper'
module Alf
module Algebra
describe Sort, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
sort(suppliers, [:name, :asc])
}
it{ should eq(op.heading) }
end
context 'when no such attribute' do
l... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/union/test_heading.rb | Ruby | mit | 49 | master | 733 | require 'spec_helper'
module Alf
module Algebra
describe Union, 'heading' do
let(:left){
an_operand.with_heading(:id => Integer, :name => String)
}
let(:expected){
Heading[:id => Integer, :name => String]
}
let(:op){
a_lispy.union(left, right)
}
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/union/test_type_check.rb | Ruby | mit | 49 | master | 559 | require 'type_check_helper'
module Alf
module Algebra
describe Union, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
union(suppliers, suppliers)
}
it{ should eq(op.heading) }
end
context 'when heading mismatch' do
let(... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/union/test_keys.rb | Ruby | mit | 49 | master | 462 | require 'spec_helper'
module Alf
module Algebra
describe Union, 'keys' do
let(:left){
an_operand.with_heading(:id => Integer, :name => String)
}
let(:right){
an_operand.with_heading(:id => Integer, :name => String)
}
let(:op){
a_lispy.union(left, right)
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/join/test_heading.rb | Ruby | mit | 49 | master | 847 | require 'spec_helper'
module Alf
module Algebra
describe Join, 'heading' do
let(:left){
an_operand.with_heading(:id => Integer, :name => String)
}
let(:op){
a_lispy.intersect(left, right)
}
subject{ op.heading }
context 'when disjoint headings' do
le... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/join/test_keys.rb | Ruby | mit | 49 | master | 1,517 | require 'spec_helper'
module Alf
module Algebra
describe Join, 'keys' do
let(:op){
a_lispy.join(left, right)
}
subject{ op.keys }
context 'on same & unique keys' do
let(:left){
an_operand.with_heading(:id => Integer, :name => String).with_keys([ :id ])
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/join/test_type_check.rb | Ruby | mit | 49 | master | 1,298 | require 'type_check_helper'
module Alf
module Algebra
describe Join, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
join(suppliers, suppliers)
}
it{ should eq(op.heading) }
end
context 'when nothing in common' do
let(:... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/ungroup/test_type_check.rb | Ruby | mit | 49 | master | 1,011 | require 'type_check_helper'
module Alf
module Algebra
describe Ungroup, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
ungroup(group(suppliers, [:status, :city], :extra), :extra)
}
it{ should eq(op.heading) }
end
context 'when... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/ungroup/test_keys.rb | Ruby | mit | 49 | master | 434 | require 'spec_helper'
module Alf
module Algebra
describe Ungroup, "keys" do
let(:operand){
an_operand.with_heading(
:id => Integer,
:names => Relation[first: String, last: String]
).with_keys([:id])
}
let(:op){
a_lispy.ungroup(operand, :names)
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/ungroup/test_heading.rb | Ruby | mit | 49 | master | 375 | require 'spec_helper'
module Alf
module Algebra
describe Ungroup, "heading" do
let(:operand){
an_operand.with_heading(id: Integer, names: Relation[name: String])
}
let(:op){
a_lispy.ungroup(operand, :names)
}
subject{ op.heading }
it{
should eq(Heading... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/matching/test_type_check.rb | Ruby | mit | 49 | master | 1,314 | require 'type_check_helper'
module Alf
module Algebra
describe Matching, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
matching(suppliers, suppliers)
}
it{ should eq(op.heading) }
end
context 'when nothing in common' do
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/matching/test_keys.rb | Ruby | mit | 49 | master | 993 | require 'spec_helper'
module Alf
module Algebra
describe Matching, 'keys' do
let(:op){
a_lispy.matching(left, right)
}
subject{ op.keys }
context 'when matching does not occurs on a right key' do
let(:left){
an_operand.with_heading(:id => Fixnum, :name => Strin... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/matching/test_heading.rb | Ruby | mit | 49 | master | 492 | require 'spec_helper'
module Alf
module Algebra
describe Matching, 'heading' do
let(:left){
an_operand.with_heading(:id => Fixnum, :name => String)
}
let(:right){
an_operand.with_heading(:id => Integer, :foo => String)
}
let(:op){
a_lispy.matching(left, rig... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/defaults/test_keys.rb | Ruby | mit | 49 | master | 428 | require 'spec_helper'
module Alf
module Algebra
describe Defaults, 'keys' do
let(:operand){
an_operand.with_heading(:id => Integer, :name => String).
with_keys([ :id ])
}
let(:op){
a_lispy.defaults(operand, {:id => lambda{12}})
}
let(:expected){
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/defaults/test_heading.rb | Ruby | mit | 49 | master | 1,043 | require 'spec_helper'
module Alf
module Algebra
describe Defaults, 'heading' do
let(:operand){
an_operand.with_heading(:id => Integer, :name => String)
}
subject{ op.heading }
context '--no-strict' do
let(:op){
a_lispy.defaults(operand, {:id => lambda{12}})
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/shared/test_to_cog.rb | Ruby | mit | 49 | master | 588 | require 'spec_helper'
module Alf
module Algebra
describe Operator, "to_cog" do
subject{ op.to_cog }
context 'on nullary' do
let(:op){
a_lispy.generator(100)
}
it{ should be_a(Engine::Cog) }
end
context 'on unary' do
let(:op){
a_lispy.... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/rename/test_type_check.rb | Ruby | mit | 49 | master | 849 | require 'type_check_helper'
module Alf
module Algebra
describe Rename, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
rename(suppliers, name: :sname)
}
it{ should eq(op.heading) }
end
context 'when invalid renaming' do
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/rename/test_heading.rb | Ruby | mit | 49 | master | 412 | require 'spec_helper'
module Alf
module Algebra
describe Rename, 'heading' do
let(:operand){
an_operand.with_heading(:id => Integer, :name => String)
}
let(:op){
a_lispy.rename(operand, :name => :foo)
}
subject{ op.heading }
let(:expected){
Heading[:... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/rename/test_complete_renaming.rb | Ruby | mit | 49 | master | 428 | require 'spec_helper'
module Alf
module Algebra
describe Rename, 'complete_renaming' do
let(:operand){
an_operand.with_heading(:id => Integer, :name => String)
}
let(:op){
a_lispy.rename(operand, :name => :foo)
}
subject{ op.complete_renaming }
let(:expected... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/rename/test_keys.rb | Ruby | mit | 49 | master | 418 | require 'spec_helper'
module Alf
module Algebra
describe Rename, 'keys' do
let(:operand){
an_operand.with_heading(:id => Integer, :name => String).with_keys([ :id ], [ :name ])
}
let(:op){
a_lispy.rename(operand, :name => :foo)
}
subject{ op.keys }
let(:expe... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/summarize/test_heading.rb | Ruby | mit | 49 | master | 773 | require 'spec_helper'
module Alf
module Algebra
describe Summarize, 'heading' do
let(:operand){
an_operand.with_heading(:id => Integer, :name => String)
}
subject{ op.heading }
context '--no-allbut' do
let(:op){
a_lispy.summarize(operand, [:name], :sum => a_li... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/summarize/test_keys.rb | Ruby | mit | 49 | master | 1,063 | require 'spec_helper'
module Alf
module Algebra
describe Summarize, 'keys' do
let(:operand){
an_operand.with_heading(:id => Integer, :name => String).with_keys([ :id ])
}
subject{ op.keys }
context 'when the by list does not have a key' do
let(:op){
a_lispy.su... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/summarize/test_type_check.rb | Ruby | mit | 49 | master | 899 | require 'type_check_helper'
module Alf
module Algebra
describe Summarize, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
summarize(supplies, [:sid], :sum => sum{ qty })
}
it{ should eq(op.heading) }
end
context 'when unknown b... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-core/test_aggregator.rb | Ruby | mit | 49 | master | 759 | require 'spec_helper'
module Alf
describe Aggregator do
let(:input){[
{:a => 1, :sign => -1},
{:a => 2, :sign => 1 },
{:a => 3, :sign => -1},
{:a => 1, :sign => -1},
]}
it "should keep track of registered aggregators" do
Aggregator.all.should be_a(Array)
Aggregator.al... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-core/alf/test_reader.rb | Ruby | mit | 49 | master | 466 | require 'spec_helper'
describe Alf, 'reader' do
def reader(*args, &bl)
Alf.reader(*args, &bl)
end
it 'supports a simple String' do
reader(File.expand_path('../example.rash', __FILE__)).should be_a(Alf::Reader)
end
it 'supports a Path' do
reader(Path.dir/'example.rash').should be_a(Alf::Reader) ... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-core/alf/test_Relation.rb | Ruby | mit | 49 | master | 751 | require 'spec_helper'
module Alf
describe "Relation" do
let(:expected){ Alf::Relation([ {name: "Jones"} ]) }
it 'works as expected on a tuple' do
Alf::Relation(:name => "Jones").should eq(expected)
end
it 'works as expected on a Reader' do
File.open(File.expand_path("../example.rash", _... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-core/alf/test_Tuple.rb | Ruby | mit | 49 | master | 523 | require 'spec_helper'
module Alf
describe "Tuple" do
context "when no arg" do
subject{ Alf::Tuple() }
it{ should be(Alf::Tuple::EMPTY) }
end
context "with an empty Hash" do
subject{ Alf::Tuple({}) }
it{ should be(Alf::Tuple::EMPTY) }
end
context "with a non-empty Hash"... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-core/alf/test_database.rb | Ruby | mit | 49 | master | 440 | require 'spec_helper'
describe Alf, '.database' do
subject{ Alf.database(Path.dir, schema_cache: false){|d| @seen = d} }
it{ should be_a(Alf::Database) }
it 'coerces the adapter' do
subject.adapter.should be_a(Alf::Adapter::Folder)
end
it 'sets the options' do
subject.schema_cache?.should eq(false... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-core/alf/test_connect.rb | Ruby | mit | 49 | master | 600 | require 'spec_helper'
describe Alf, '.connect' do
it "recognizes an existing folder" do
db = Alf.connect(File.dirname(__FILE__))
db.should be_a(Alf::Database::Connection)
end
it "recognizes an existing folder through a Path instance" do
db = Alf.connect(Path.dir)
db.should be_a(Alf::Database::Co... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-core/assumptions/test_scoping.rb | Ruby | mit | 49 | master | 516 | require 'spec_helper'
describe :clojures_and_scoping do
class Foo
def a_method
:inside
end
def evaluate(lamb)
if RUBY_VERSION <= "1.9"
self.instance_eval(&lamb)
else
self.instance_exec(&lamb)
end
end
end
specify "when no name clash" do
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-core/assumptions/test_instance_eval.rb | Ruby | mit | 49 | master | 274 | require 'spec_helper'
describe :instance_eval do
let(:bar){ lambda{10} }
let(:foo) { Object.new }
if RUBY_VERSION <= "1.9"
subject{ foo.instance_eval(&bar) }
it { should == 10 }
else
subject{ foo.instance_exec(&bar) }
it { should == 10 }
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-core/assumptions/test_file.rb | Ruby | mit | 49 | master | 396 | require 'spec_helper'
describe "__FILE__" do
describe "when used with eval within same file" do
let(:src){ "__FILE__" }
subject{ Kernel.eval(src, binding, __FILE__) }
it { should == __FILE__ }
end
describe "when used with eval from other file" do
let(:src){ "__FILE__" }
subject{ Kernel.ev... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-core/assumptions/test_set.rb | Ruby | mit | 49 | master | 1,489 | require 'spec_helper'
require 'set'
describe Set do
specify "empty sets should be equal" do
Set.new([]).should eq(Set.new([]))
Set.new([]).should eql(Set.new([]))
end
describe "on DEE-like sets" do
let(:dee){ Set.new([{}]) }
specify "DEE sets should be equal" do
Set.new([{}]).sh... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-types/test_ordering.rb | Ruby | mit | 49 | master | 308 | require 'spec_helper'
module Alf
describe Ordering do
def Ordering.exemplars
[
[],
[:a],
[[:a, :asc], [:b, :asc]]
].map{|x| Ordering.coerce(x)}
end
let(:type){ Ordering }
it_should_behave_like 'A valid type implementation'
end # Ordering
end # Alf |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-types/test_tuple_expression.rb | Ruby | mit | 49 | master | 334 | require 'spec_helper'
module Alf
describe TupleExpression do
def TupleExpression.exemplars
[
->{ 10 },
->(t){ t.status > 10 },
].map{|x| TupleExpression.coerce(x)}
end
let(:type){ TupleExpression }
it_should_behave_like 'A valid type implementation'
end # TupleExpress... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-types/test_tuple_computation.rb | Ruby | mit | 49 | master | 727 | require 'spec_helper'
module Alf
describe TupleComputation do
describe "the class itself" do
let(:type){ TupleComputation }
def TupleComputation.exemplars
[
{status: 10},
{big?: "status > 10"}
].map{|x| TupleComputation.coerce(x)}
end
it_should_behave_l... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-types/test_class_methods.rb | Ruby | mit | 49 | master | 2,029 | require 'spec_helper'
module Alf
describe Types do
include Types
describe "common_super_type" do
it 'works on same types' do
common_super_type(String, String).should eq(String)
end
it 'works with related types' do
common_super_type(Fixnum, Integer).should eq(Integer)
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-types/test_renaming.rb | Ruby | mit | 49 | master | 328 | require 'spec_helper'
module Alf
describe Renaming do
def Renaming.exemplars
[
{},
{:old1 => :new1},
{:old1 => :new1, :old2 => :new2}
].map{|x| Renaming.coerce(x)}
end
let(:type){ Renaming }
it_should_behave_like 'A valid type implementation'
end # Renaming
en... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-types/test_heading.rb | Ruby | mit | 49 | master | 1,411 | require 'spec_helper'
module Alf
describe Heading do
describe "the class itself" do
let(:type){ Heading }
def Heading.exemplars
[
{},
{:a => String},
{:a => String, :b => Date}
].map{|x| Heading.coerce(x)}
end
it_should_behave_like 'A valid ty... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-types/test_summarization.rb | Ruby | mit | 49 | master | 843 | require 'spec_helper'
module Alf
describe Summarization do
describe "the class itself" do
let(:type){ Summarization }
def Summarization.exemplars
[
["total", Aggregator.sum{ qty }]
].map{|x| Summarization.coerce(x)}
end
it_should_behave_like 'A valid type impleme... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.