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-viewpoint/test_metadata.rb | Ruby | mit | 49 | master | 573 | require 'spec_helper'
module Alf
describe Viewpoint, "metadata" do
subject{ viewpoint.metadata }
let(:viewpoint){
Module.new{
include Viewpoint
}
}
it 'should be a Metadata instance' do
subject.should be_a(Viewpoint::Metadata)
end
it 'should always be the same on ... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-viewpoint/test_native.rb | Ruby | mit | 49 | master | 505 | require 'spec_helper'
module Alf
describe Viewpoint, ".native" do
let(:viewpoint){
Module.new{
include Alf::Viewpoint
native :hello
native :hello2, :native_hello2
}
}
it 'uses the logical name when no physical name is provided' do
viewpoint.parse{
hello
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-viewpoint/test_depends.rb | Ruby | mit | 49 | master | 319 | require 'spec_helper'
module Alf
describe Viewpoint, "depends" do
let(:viewpoint){
Module.new{
include Viewpoint
depends :a, 1, 2
depends :b, 3, 4
}
}
it 'populates metadata' do
viewpoint.metadata.dependencies.should eq(a: [1, 2], b: [3, 4])
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-viewpoint/test_expects.rb | Ruby | mit | 49 | master | 297 | require 'spec_helper'
module Alf
describe Viewpoint, "expects" do
let(:viewpoint){
Module.new{
include Viewpoint
expects 1, 2
expects 3
}
}
it 'populates metadata' do
viewpoint.metadata.expectations.should eq([1, 2, 3])
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-viewpoint/test_parse.rb | Ruby | mit | 49 | master | 762 | require 'spec_helper'
module Alf
describe Viewpoint, "parse" do
subject{ viewpoint.parse(&expr) }
context 'on predicate expressions' do
let(:viewpoint){ Viewpoint }
let(:expr){ ->{ eq(:x, 2) } }
it{ should be_a(Predicate) }
end
context 'on relational expressions' do
let(:vi... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-viewpoint/test_native_const.rb | Ruby | mit | 49 | master | 456 | require 'spec_helper'
module Alf
describe Viewpoint, "NATIVE" do
subject{ Viewpoint::NATIVE }
it{ should be_a(Module) }
it 'converts unknown names as named operands' do
subject.parse{
suppliers
}.should be_a(Algebra::Operand::Named)
end
it 'should allow being used in a Lisp... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-viewpoint/test_parser.rb | Ruby | mit | 49 | master | 442 | require 'spec_helper'
module Alf
describe Viewpoint, "parse" do
context 'when called without connection' do
subject{ Viewpoint.parser }
it 'returns an unbound Lispy' do
subject.connection.should be_nil
end
end
context 'when called with a connection' do
subject{ Viewpoint... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-viewpoint/metadata/test_expand.rb | Ruby | mit | 49 | master | 809 | require 'spec_helper'
module Alf
module Viewpoint
describe Metadata, ".reduce" do
subject{ metadata.expand }
let(:metadata) do
@base = base = viewpoint{ }
@user = user = viewpoint{ expects(base) }
@util1 = util1 = viewpoint{ expects(base); depends(:user, user) }
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-viewpoint/metadata/test_expects.rb | Ruby | mit | 49 | master | 838 | require 'spec_helper'
module Alf
module Viewpoint
describe Metadata, "#expects" do
context 'on empty expectations' do
let(:metadata){ Metadata.new }
subject{ metadata.expects([1, 2]) }
it 'sets expectations' do
subject.expectations.should eq([1, 2])
end
end... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-viewpoint/metadata/test_initialize.rb | Ruby | mit | 49 | master | 861 | require 'spec_helper'
module Alf
module Viewpoint
describe Metadata, "#initialize" do
context 'without args' do
subject{ Metadata.new }
it 'has empty expectations' do
subject.expectations.should eq([])
end
it 'has empty dependencies' do
subject.dependen... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-viewpoint/metadata/test_to_module.rb | Ruby | mit | 49 | master | 874 | require 'spec_helper'
module Alf
module Viewpoint
describe Metadata, "#to_module" do
subject{ metadata.to_module }
let(:metadata) do
@base = base = viewpoint{ }
@user = user = viewpoint{ expects(base) }
@util1 = util = viewpoint{ expects(base); depends(:user, user) }
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-viewpoint/metadata/test_add_members.rb | Ruby | mit | 49 | master | 830 | require 'spec_helper'
module Alf
module Viewpoint
describe Metadata, "#add_members" do
context 'on empty expectations' do
let(:metadata){ Metadata.new }
subject{ metadata.add_members([1, 2]) }
it 'sets members' do
subject.members.should eq([1, 2])
end
end
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-viewpoint/metadata/test_all_members.rb | Ruby | mit | 49 | master | 769 | require 'spec_helper'
module Alf
module Viewpoint
describe Metadata, "all_members" do
let(:metadata) do
@base = base = viewpoint{ native :base }
@user = user = viewpoint{ expects(base); native :user }
@util1 = util1 = viewpoint{ expects(base); depends(:user, user) }
@u... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-viewpoint/metadata/test_depends.rb | Ruby | mit | 49 | master | 1,268 | require 'spec_helper'
module Alf
module Viewpoint
describe Metadata, "#depends" do
context 'on empty dependencies' do
let(:metadata){ Metadata.new }
subject{ metadata.depends(a: [1, 2]) }
it 'sets dependencies' do
subject.dependencies.should eq(a: [1, 2])
end
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-viewpoint/metadata/test_dup.rb | Ruby | mit | 49 | master | 903 | require 'spec_helper'
module Alf
module Viewpoint
describe Metadata, "#dup" do
let(:metadata){ Metadata.new([1, 2], {a: [3, 4]}, [:m]) }
subject{ metadata.dup }
it 'should be a different Metadata' do
subject.should be_a(Metadata)
subject.should_not be(metadata)
end
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/memory/test_delete.rb | Ruby | mit | 49 | master | 719 | require 'spec_helper'
module Alf
module Relvar
describe Memory, "affect" do
let(:before){ Relation(id: [1, 2, 3, 4]) }
let(:after) { Relation(id: [1, 3, 4]) }
let(:rv) { Memory.new(before) }
subject{
rv.delete(predicate)
}
context 'with a real Predicate' do
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/memory/test_to_relation.rb | Ruby | mit | 49 | master | 291 | require 'spec_helper'
module Alf
module Relvar
describe Memory, "to_relation" do
let(:value){ Relation(id: 1) }
let(:rv) { Memory.new(value) }
subject{ rv.to_relation }
it 'is as expected' do
subject.should be(value)
end
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/memory/test_affect.rb | Ruby | mit | 49 | master | 358 | require 'spec_helper'
module Alf
module Relvar
describe Memory, "affect" do
let(:before){ Relation(id: 1) }
let(:after) { Relation(id: 2) }
let(:rv) { Memory.new(before) }
subject{
rv.affect(after)
}
it 'is as expected' do
subject
rv.value.should e... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/memory/test_update.rb | Ruby | mit | 49 | master | 472 | require 'spec_helper'
module Alf
module Relvar
describe Memory, "update" do
let(:before) { Relation(id: [1, 2, 3, 4]) }
let(:after) { Relation(id: [1, 10, 3, 4]) }
let(:updating) { {id: 10} }
let(:predicate){ {id: 2} }
let(:rv) { Memory.new(before) }
subject{
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/memory/test_insert.rb | Ruby | mit | 49 | master | 916 | require 'spec_helper'
module Alf
module Relvar
describe Memory, "insert" do
let(:before) { Relation(id: [1, 2]) }
let(:after) { Relation(id: [1, 2, 3]) }
let(:rv) { Memory.new(before) }
subject{
rv.insert(inserted)
}
context 'with a Relation' do
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/read_only/test_to_relation.rb | Ruby | mit | 49 | master | 297 | require 'spec_helper'
module Alf
module Relvar
describe ReadOnly, "to_relation" do
let(:value){ Relation(id: 1) }
let(:rv) { ReadOnly.new(value) }
subject{ rv.to_relation }
it 'is as expected' do
subject.should be(value)
end
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/read_only/test_type.rb | Ruby | mit | 49 | master | 298 | require 'spec_helper'
module Alf
module Relvar
describe ReadOnly, "type" do
let(:value){ Relation(id: 1) }
let(:rv) { ReadOnly.new(value) }
subject{ rv.type }
it 'is as expected' do
subject.should eq(Relation[id: Fixnum])
end
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/virtual/test_expr.rb | Ruby | mit | 49 | master | 280 | require 'spec_helper'
module Alf
module Relvar
describe Virtual, "expr" do
let(:expr){ Algebra::Operand::Named.new(:aname, self) }
let(:rv) { Virtual.new(expr) }
subject{ rv.expr }
it{ should be(expr) }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/virtual/test_to_lispy.rb | Ruby | mit | 49 | master | 347 | require 'spec_helper'
module Alf
module Relvar
describe Virtual, "to_lispy" do
let(:expr){ Algebra::Operand::Named.new(:aname, self) }
let(:rv) { Virtual.new(expr) }
subject{ rv.to_lispy }
it 'delegates to the expression' do
subject.should eq("aname")
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/virtual/test_to_relvar.rb | Ruby | mit | 49 | master | 288 | require 'spec_helper'
module Alf
module Relvar
describe Virtual, "to_relvar" do
let(:expr){ Algebra::Operand::Named.new(:aname, self) }
let(:rv) { Virtual.new(expr) }
subject{ rv.to_relvar }
it{ should be(rv) }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/virtual/test_to_cog.rb | Ruby | mit | 49 | master | 347 | require 'spec_helper'
module Alf
module Relvar
describe Virtual, "to_cog" do
let(:expr){ Algebra::Operand::Named.new(:aname, self) }
let(:rv) { Virtual.new(expr) }
subject{ rv.to_cog(12) }
def cog(*args)
@seen = args
end
it{ should eq([12, e... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/virtual/test_delete.rb | Ruby | mit | 49 | master | 861 | require 'spec_helper'
module Alf
module Relvar
describe Virtual, "delete" do
let(:rv) { Virtual.new(expr) }
let(:expr) { Algebra.named_operand(:suppliers, self) }
def delete(*args)
@seen = args
end
def relvar(name)
Relvar::Base.new... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/virtual/test_keys.rb | Ruby | mit | 49 | master | 417 | require 'spec_helper'
module Alf
module Relvar
describe Virtual, "keys" do
let(:expr){ Algebra::Operand::Named.new(:aname, self) }
let(:rv) { Virtual.new(expr) }
def keys(name)
"some keys for #{name}"
end
subject{ rv.keys }
it 'delegates to ... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/virtual/test_oo_lang.rb | Ruby | mit | 49 | master | 771 | require 'spec_helper'
module Alf
module Relvar
describe Virtual, 'OO relational language' do
let(:expr){ Algebra::Operand::Named.new(:suppliers, self) }
let(:base){ Base.new(expr) }
let(:rv) { Virtual.new(base) }
subject{ rv.pro... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/virtual/test_heading.rb | Ruby | mit | 49 | master | 426 | require 'spec_helper'
module Alf
module Relvar
describe Virtual, "heading" do
let(:expr){ Algebra::Operand::Named.new(:aname, self) }
let(:rv) { Virtual.new(expr) }
def heading(name)
"a heading for #{name}"
end
subject{ rv.heading }
it 'dele... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/virtual/test_insert.rb | Ruby | mit | 49 | master | 701 | require 'spec_helper'
module Alf
module Relvar
describe Virtual, "insert" do
let(:rv) { Virtual.new(expr) }
let(:expr) { Algebra.named_operand(:suppliers, connection) }
let(:tuples) { Relation.coerce(:id => 1) }
let(:connectio... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/virtual/test_to_s.rb | Ruby | mit | 49 | master | 300 | require 'spec_helper'
module Alf
module Relvar
describe Virtual, "to_s" do
let(:expr){ Algebra::Operand::Named.new(:aname, self) }
let(:rv) { Virtual.new(expr) }
subject{ rv.to_s }
it{ should eq("Relvar::Virtual(aname)") }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/virtual/test_update.rb | Ruby | mit | 49 | master | 686 | require 'spec_helper'
module Alf
module Relvar
describe Virtual, "update" do
let(:rv) { Virtual.new(expr) }
let(:expr) { Algebra.named_operand(:suppliers, self) }
let(:updating) { {sname: 'Jones'} }
let(:predicate) { Predicate.eq(:... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/base/test_insert.rb | Ruby | mit | 49 | master | 520 | require 'spec_helper'
module Alf
module Relvar
describe Base, "insert" do
let(:expr) { Algebra::Operand::Named.new(:suppliers, self) }
let(:rv) { Base.new(expr) }
let(:tuples){ Relation.coerce(:id => 1) }
def insert(*args)
@s... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/base/test_update.rb | Ruby | mit | 49 | master | 571 | require 'spec_helper'
module Alf
module Relvar
describe Base, "update" do
let(:expr){ Algebra::Operand::Named.new(:suppliers, self) }
let(:rv) { Base.new(expr) }
let(:updating) { {sname: 'Jones'} }
let(:predicate) { Predicate.eq(:sid, 1) }
def... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/base/test_lock.rb | Ruby | mit | 49 | master | 473 | require 'spec_helper'
module Alf
module Relvar
describe Base, "insert" do
let(:expr){ Algebra::Operand::Named.new(:suppliers, self) }
let(:rv) { Base.new(expr) }
def lock(*args)
yield(args)
end
subject{ rv.lock(:exclusive){|args| @seen = arg... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/base/test_to_lispy.rb | Ruby | mit | 49 | master | 300 | require 'spec_helper'
module Alf
module Relvar
describe Base, "to_lispy" do
let(:expr){ Algebra::Operand::Named.new(:suppliers, self) }
let(:rv) { Base.new(expr) }
subject{ rv.to_lispy }
it{ should eq("suppliers") }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/base/test_oo_lang.rb | Ruby | mit | 49 | master | 1,166 | require 'spec_helper'
module Alf
module Relvar
describe Base, 'OO relational language' do
let(:expr){ Algebra::Operand::Named.new(:suppliers, self) }
let(:rv) { Base.new(expr) }
shared_examples_for "the result of a query operator" do
it 'is a relation va... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/base/test_to_s.rb | Ruby | mit | 49 | master | 307 | require 'spec_helper'
module Alf
module Relvar
describe Base, "to_s" do
let(:expr){ Algebra::Operand::Named.new(:suppliers, self) }
let(:rv) { Base.new(expr) }
subject{ rv.to_s }
it{ should eq("Relvar::Base(:suppliers)") }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/base/test_heading.rb | Ruby | mit | 49 | master | 395 | require 'spec_helper'
module Alf
module Relvar
describe Base, "heading" do
let(:expr){ Algebra::Operand::Named.new(:suppliers, self) }
let(:rv) { Base.new(expr) }
def heading(*args)
@seen = args
end
subject{ rv.heading }
it 'delegates to the connection' do
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/base/test_connection.rb | Ruby | mit | 49 | master | 293 | require 'spec_helper'
module Alf
module Relvar
describe Base, "connection" do
let(:expr){
Algebra::Operand::Named.new(:aname, :aconn)
}
let(:rv){
Base.new(expr)
}
subject{ rv.connection }
it{ should eq(:aconn) }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/base/test_to_relvar.rb | Ruby | mit | 49 | master | 293 | require 'spec_helper'
module Alf
module Relvar
describe Base, "to_relvar" do
let(:expr){ Algebra::Operand::Named.new(:suppliers, self) }
let(:rv) { Base.new(expr) }
subject{ rv.to_relvar }
it{ should be(rv) }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/base/test_keys.rb | Ruby | mit | 49 | master | 417 | require 'spec_helper'
module Alf
module Relvar
describe Base, "keys" do
let(:expr){ Algebra::Operand::Named.new(:suppliers, self) }
let(:rv) { Base.new(expr) }
def keys(*args)
@seen = args
end
subject{ rv.keys }
it 'delegates to the c... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/base/test_to_cog.rb | Ruby | mit | 49 | master | 422 | require 'spec_helper'
module Alf
module Relvar
describe Base, "to_cog" do
let(:expr){ Algebra::Operand::Named.new(:suppliers, self) }
let(:rv) { Base.new(expr) }
def cog(*args)
@seen = args
end
subject{ rv.to_cog(12) }
it 'delegates t... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/base/test_delete.rb | Ruby | mit | 49 | master | 742 | require 'spec_helper'
module Alf
module Relvar
describe Base, "delete" do
let(:expr){ Algebra::Operand::Named.new(:suppliers, self) }
let(:rv) { Base.new(expr) }
def delete(*args)
@seen = args
end
context 'with a predicate' do
let(:predicate) { Predicate.eq(:sid, ... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/shared/test_empty.rb | Ruby | mit | 49 | master | 321 | require 'spec_helper'
module Alf
describe Relvar, 'empty?' do
include Relvar
subject{ empty? }
context 'on an empty relvar' do
let(:to_cog){ [] }
it{ should be_true }
end
context 'on an non empty relvar' do
let(:to_cog){ [ 1 ] }
it{ should be_false }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/shared/test_to_relation.rb | Ruby | mit | 49 | master | 219 | require 'spec_helper'
module Alf
describe Relvar, 'to_relation' do
include Relvar
subject{ to_relation }
def to_cog
Struct.new(:to_relation).new(:foo)
end
it{ should eq(:foo) }
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/shared/test_not_empty_bang.rb | Ruby | mit | 49 | master | 652 | require 'spec_helper'
module Alf
describe Relvar, 'not_empty!' do
include Relvar
subject{ not_empty! }
context 'on an empty relvar' do
let(:to_cog){ [] }
it "should raise a fact error" do
lambda{ subject }.should raise_error(Alf::FactAssertionError)
end
end
context 'o... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/shared/test_empty_bang.rb | Ruby | mit | 49 | master | 647 | require 'spec_helper'
module Alf
describe Relvar, 'empty!' do
include Relvar
subject{ empty! }
context 'on an empty relvar' do
let(:to_cog){ [] }
it{ should be(self) }
end
context 'on an non empty relvar' do
let(:to_cog){ [ 1 ] }
it "should raise a fact error" do
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/shared/test_type.rb | Ruby | mit | 49 | master | 351 | require 'spec_helper'
module Alf
describe Relvar, 'type' do
include Relvar
def heading(*)
Heading.new(sid: Integer, name: String)
end
subject{ type }
it 'returns the expected type' do
subject.should eq(Relation[heading])
end
it 'memoizes used instance' do
subject.shou... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-relvar/shared/test_upsert.rb | Ruby | mit | 49 | master | 777 | require 'spec_helper'
module Alf
describe Relvar, "upsert" do
include Relvar
let(:tuples){ Relation.coerce(:id => 1) }
def insert(*args)
@method = :insert
@seen = args
end
def update(*args)
@method = :update
@seen = args
end
subject{ upsert(tuples) }
contex... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/test_operator.rb | Ruby | mit | 49 | master | 343 | require 'spec_helper'
module Alf
module Algebra
describe Operator do
specify "each" do
ops = []
Operator.each{|m| ops << m}
nonrel = []
NonRelational.each{|m| nonrel << m}
rel = []
Relational.each{|m| rel << m}
ops.should == nonrel + rel
end... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/test_rewriter.rb | Ruby | mit | 49 | master | 602 | require 'spec_helper'
module Alf
module Algebra
describe Rewriter do
let(:expr){
l = a_lispy
l.project(l.rename(an_operand, :firstname => :name), [:name])
}
let(:rewriter){
Rewriter.new
}
subject{ rewriter.call(expr) }
it 'returns an equal expression... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/support/test_non_relational.rb | Ruby | mit | 49 | master | 400 | require 'spec_helper'
module Alf
module Algebra
describe NonRelational do
specify "each" do
x = []
NonRelational.each{|m| x << m}
x.sort{|m1,m2| m1.name.to_s <=> m2.name.to_s}.should == [
Autonum,
Clip,
Coerce,
Compact,
Defaults,... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/support/test_relational.rb | Ruby | mit | 49 | master | 670 | require 'spec_helper'
module Alf
module Algebra
describe Relational do
specify "each" do
x = []
Relational.each{|m| x << m}
x.sort{|m1,m2| m1.name.to_s <=> m2.name.to_s}.should == [
Allbut,
Extend,
Frame,
Group,
Hierarchize,
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/support/with_ordering/test_total_ordering.rb | Ruby | mit | 49 | master | 1,364 | require 'spec_helper'
module Alf
module Algebra
describe WithOrdering, 'total_ordering' do
include WithOrdering
subject{ total_ordering }
def keys
operand.keys
end
def heading
operand.heading
end
context 'when the initial ordering covers a key' do
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/support/signature/test_install.rb | Ruby | mit | 49 | master | 1,408 | require 'spec_helper'
module Alf
module Algebra
describe Signature, '.install' do
let(:clazz){ Class.new(Object) }
subject{ signature.install }
describe "on an empty signature" do
let(:signature){ Signature.new(clazz) }
it{ should eq({}) }
specify{
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/support/signature/test_to_lispy.rb | Ruby | mit | 49 | master | 3,231 | require 'spec_helper'
module Alf
module Algebra
describe Signature, '#to_lispy' do
subject{ signature.to_lispy }
describe "on a nullary signature" do
let(:clazz){ Generator }
describe "on an empty signature" do
let(:signature){ Signature.new(clazz){|s|} }
it{ sho... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/support/signature/test_parse_args.rb | Ruby | mit | 49 | master | 2,322 | require 'spec_helper'
module Alf
module Algebra
describe Signature, "#parse_args" do
class FakeOp
attr_accessor :operands
end
let(:receiver){ FakeOp.new }
let(:operand){ an_operand }
before{
signature.install
}
subject{
signature.parse_args(arg... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/support/signature/test_collect_on.rb | Ruby | mit | 49 | master | 1,047 | require 'spec_helper'
module Alf
module Algebra
describe Signature, "#collect_on" do
subject{ op.class.signature.collect_on(op) }
let(:suppliers){ an_operand }
let(:cities) { an_operand }
let(:operands) { subject[0] }
let(:arguments) { subject[1] }
let(:options) { subje... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/support/signature/test_initialize.rb | Ruby | mit | 49 | master | 520 | require 'spec_helper'
module Alf
module Algebra
describe Signature, '.initialize' do
subject{
Signature.new(nil){|s|
s.argument :name, AttrName, :autonum
s.option :allbut, Boolean, true, "Applies an allbut projection?"
}
}
it "yields the signature" d... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/support/signature/test_option_parser.rb | Ruby | mit | 49 | master | 997 | require 'spec_helper'
module Alf
module Algebra
describe Signature, '#option_parser' do
let(:clazz){ Class.new(Object) }
let(:signature){
Signature.new(clazz) do |s|
s.option :allbut, Boolean, true
s.option :name, AttrName, :autonum
end
}
let(:receiv... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/support/binary/test_with_left.rb | Ruby | mit | 49 | master | 584 | require 'spec_helper'
module Alf
module Algebra
describe Binary, "with_left" do
let(:operand_1){ an_operand }
let(:operand_2){ an_operand }
let(:operand_3){ an_operand }
let(:operator) { a_lispy.union(operand_1, operand_2) }
subject{ operator.with_left(operand_3) }
it{ shoul... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/support/binary/test_with_right.rb | Ruby | mit | 49 | master | 577 | require 'spec_helper'
module Alf
module Algebra
describe Binary, "with_right" do
let(:operand_1){ an_operand }
let(:operand_2){ an_operand }
let(:operand_3){ an_operand }
let(:operator) { a_lispy.union(operand_1, operand_2) }
subject{ operator.with_right(operand_3) }
it{ sho... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/support/unary/test_with_operand.rb | Ruby | mit | 49 | master | 623 | require 'spec_helper'
module Alf
module Algebra
describe Unary, "with_operand" do
let(:operand_1){ an_operand }
let(:operand_2){ an_operand }
let(:extension){ TupleComputation.coerce({:big => "tested > 10"}) }
let(:operator) { a_lispy.extend(operand_1, extension) }
subject{ operat... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operand/test_proxy.rb | Ruby | mit | 49 | master | 1,139 | require 'spec_helper'
module Alf
module Algebra
module Operand
describe Proxy do
DELEGATED = [ :heading, :keys ]
subject{
Proxy.new(victim).send(method)
}
DELEGATED.each do |method|
context "with #{method} with knowing victim" do
let(:method... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operand/test_coerce.rb | Ruby | mit | 49 | master | 849 | require 'spec_helper'
module Alf
module Algebra
describe Operand, '.coerce' do
subject{ Operand.coerce(arg) }
context "on a Symbol" do
let(:arg){ :suppliers }
it 'coerces it as a named operand' do
subject.should be_a(Operand::Named)
subject.name.should eq(:suppli... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operand/named/test_to_relvar.rb | Ruby | mit | 49 | master | 316 | require 'spec_helper'
module Alf
module Algebra
module Operand
describe Named, "to_relvar" do
let(:operand){ Named.new(:foo, self) }
subject{ operand.to_relvar }
it 'returns a base relvar' do
subject.should be_a(Relvar::Base)
end
end
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operand/named/test_keys.rb | Ruby | mit | 49 | master | 379 | require 'spec_helper'
module Alf
module Algebra
module Operand
describe Named, "keys" do
let(:operand){ Named.new(:foo, self) }
subject{ operand.keys }
def keys(name)
[name]
end
it 'delegates to the underlying connection when bound' do
subject.... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operand/named/test_to_ascii_tree.rb | Ruby | mit | 49 | master | 315 | require 'spec_helper'
module Alf
module Algebra
module Operand
describe Named, "to_ascii_tree" do
subject{ operand.to_ascii_tree }
let(:operand){ Named.new(:foo, self) }
it 'returns the heading' do
subject.should eq("foo\n")
end
end
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operand/named/test_type_check.rb | Ruby | mit | 49 | master | 763 | require 'spec_helper'
module Alf
module Algebra
module Operand
describe Named, "type_check" do
subject{ operand.type_check }
def knows?(name)
name == :foo
end
def heading(name)
:"#{name}_heading"
end
context 'when known' do
le... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operand/named/test_hash_and_equal.rb | Ruby | mit | 49 | master | 1,147 | require 'spec_helper'
module Alf
module Algebra
module Operand
describe Named, "hash and ==" do
let(:op1){
Named.new(:foo)
}
context '==' do
it 'recognizes same operands' do
op1.should eq(op1)
op1.should eq(Named.new(:foo))
end... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operand/named/test_to_cog.rb | Ruby | mit | 49 | master | 476 | require 'spec_helper'
module Alf
module Algebra
module Operand
describe Named, "to_cog" do
let(:operand){ Named.new(:foo, self) }
subject{ operand.to_cog(12) }
def cog(plan, expr)
plan.should eq(12)
expr.should be(operand)
[:a_cog, expr.name]
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operand/proxy/test_to_cog.rb | Ruby | mit | 49 | master | 759 | require 'spec_helper'
module Alf
module Algebra
module Operand
describe Proxy, "to_cog" do
subject{
proxy.to_cog
}
let(:proxy){
Proxy.new(proxied)
}
context 'when delegable' do
let(:proxied){
Struct.new(:to_cog).new(:compil... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_autonum.rb | Ruby | mit | 49 | master | 725 | require 'spec_helper'
module Alf
module Algebra
describe Autonum do
let(:operator_class){ Autonum }
it_should_behave_like("An operator class")
context "with default attribute name" do
subject{ a_lispy.autonum(an_operand) }
it{ should be_a(Autonum) }
it 'has :autonum ... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_project.rb | Ruby | mit | 49 | master | 656 | require 'spec_helper'
module Alf
module Algebra
describe Project do
let(:operator_class){ Project }
it_should_behave_like("An operator class")
context "--no-allbut" do
subject{ a_lispy.project(an_operand, [:a]) }
it { should be_a(Project) }
it 'is !allbut by default'... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_generator.rb | Ruby | mit | 49 | master | 477 | require 'spec_helper'
module Alf
module Algebra
describe Generator do
let(:operator_class){ Generator }
it_should_behave_like("An operator class")
context "when providing a size and a name" do
subject{ a_lispy.generator(2, :id) }
it{ should be_a(Generator) }
it 'has ... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_clip.rb | Ruby | mit | 49 | master | 638 | require 'spec_helper'
module Alf
module Algebra
describe Clip do
let(:operator_class){ Clip }
it_should_behave_like("An operator class")
context "--no-allbut" do
subject{ a_lispy.clip(an_operand, [:a]) }
it { should be_a(Clip) }
it 'is !allbut by default' do
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_rank.rb | Ruby | mit | 49 | master | 261 | require 'spec_helper'
module Alf
module Algebra
describe Rank do
let(:operator_class){ Rank }
it_should_behave_like("An operator class")
subject{ a_lispy.rank(an_operand, [:weight]) }
it{ should be_a(Rank) }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_rename.rb | Ruby | mit | 49 | master | 270 | require 'spec_helper'
module Alf
module Algebra
describe Rename do
let(:operator_class){ Rename }
it_should_behave_like("An operator class")
subject{ a_lispy.rename(an_operand, {:a => :z}) }
it{ should be_a(Rename) }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_defaults.rb | Ruby | mit | 49 | master | 697 | require 'spec_helper'
module Alf
module Algebra
describe Defaults do
let(:operator_class){ Defaults }
it_should_behave_like("An operator class")
context "--no-strict" do
subject{ a_lispy.defaults(an_operand, :a => 1, :c => "blue") }
it{ should be_a(Defaults) }
it 'is... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_minus.rb | Ruby | mit | 49 | master | 266 | require 'spec_helper'
module Alf
module Algebra
describe Minus do
let(:operator_class){ Minus }
it_should_behave_like("An operator class")
subject{ a_lispy.minus(an_operand, an_operand) }
it{ should be_a(Minus) }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_ungroup.rb | Ruby | mit | 49 | master | 268 | require 'spec_helper'
module Alf
module Algebra
describe Ungroup do
let(:operator_class){ Ungroup }
it_should_behave_like("An operator class")
subject{ a_lispy.ungroup(an_operand, :as) }
it { should be_a(Ungroup) }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_sort.rb | Ruby | mit | 49 | master | 285 | require 'spec_helper'
module Alf
module Algebra
describe Sort do
let(:operator_class){ Sort }
it_should_behave_like("An operator class")
subject{ a_lispy.sort(an_operand, [[:first, :asc], [:second, :asc]]) }
it{ should be_a(Sort) }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_union.rb | Ruby | mit | 49 | master | 267 | require 'spec_helper'
module Alf
module Algebra
describe Union do
let(:operator_class){ Union }
it_should_behave_like("An operator class")
subject{ a_lispy.union(an_operand, an_operand) }
it { should be_a(Union) }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_coerce.rb | Ruby | mit | 49 | master | 411 | require 'spec_helper'
module Alf
module Algebra
describe Coerce do
let(:operator_class){ Coerce }
it_should_behave_like("An operator class")
subject{ a_lispy.coerce(an_operand, :a => Integer, :b => Float) }
it { should be_a(Coerce) }
it 'should be bound correctly' do
sub... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_page.rb | Ruby | mit | 49 | master | 599 | require 'spec_helper'
module Alf
module Algebra
describe Page do
let(:operator_class){ Page }
it_should_behave_like("An operator class")
subject{
a_lispy.page(an_operand, [[:name, :asc]], 2)
}
it { should be_a(Page) }
it 'should have correct ordering' do
su... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_compact.rb | Ruby | mit | 49 | master | 263 | require 'spec_helper'
module Alf
module Algebra
describe Compact do
let(:operator_class){ Compact }
it_should_behave_like("An operator class")
subject{ a_lispy.compact(an_operand) }
it { should be_a(Compact) }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_summarize.rb | Ruby | mit | 49 | master | 850 | require 'spec_helper'
module Alf
module Algebra
describe Summarize do
let(:operator_class){ Summarize }
it_should_behave_like("An operator class")
let(:aggs){{:time_sum => Aggregator.sum{ time },
:time_max => Aggregator.max{ time },
:time_avg => Aggregator.... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_hash_and_equal.rb | Ruby | mit | 49 | master | 1,268 | require 'spec_helper'
module Alf
module Algebra
describe Operator, "hash and ==" do
let(:foo){
Operand::Named.new(:foo)
}
let(:bar){
Operand::Named.new(:bar)
}
let(:op1){
a_lispy.restrict(foo, x: 12)
}
context '==' do
it 'recognizes sa... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_quota.rb | Ruby | mit | 49 | master | 388 | require 'spec_helper'
module Alf
module Algebra
describe Quota do
let(:operator_class){ Quota }
it_should_behave_like("An operator class")
let(:aggs){{:time_sum => Aggregator.sum{ time },
:time_max => Aggregator.max{ time }}}
subject{ a_lispy.quota(an_operand, [:a], [... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_wrap.rb | Ruby | mit | 49 | master | 645 | require 'spec_helper'
module Alf
module Algebra
describe Wrap do
let(:operator_class){ Wrap }
it_should_behave_like("An operator class")
context '--no-allbut' do
subject{ a_lispy.wrap(an_operand, [:a, :b], :wraped) }
it { should be_a(Wrap) }
it 'should not be allbut... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_join.rb | Ruby | mit | 49 | master | 263 | require 'spec_helper'
module Alf
module Algebra
describe Join do
let(:operator_class){ Join }
it_should_behave_like("An operator class")
subject{ a_lispy.join(an_operand, an_operand) }
it { should be_a(Join) }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_unwrap.rb | Ruby | mit | 49 | master | 269 | require 'spec_helper'
module Alf
module Algebra
describe Unwrap do
let(:operator_class){ Unwrap }
it_should_behave_like("An operator class")
subject{ a_lispy.unwrap(an_operand, :wrapped) }
it { should be_a(Unwrap) }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_restrict.rb | Ruby | mit | 49 | master | 288 | require 'spec_helper'
module Alf
module Algebra
describe Restrict do
let(:operator_class){ Restrict }
it_should_behave_like("An operator class")
subject{ a_lispy.restrict(an_operand, lambda{ name < 10 }) }
it { should be_a(Restrict) }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_extend.rb | Ruby | mit | 49 | master | 289 | require 'spec_helper'
module Alf
module Algebra
describe Extend do
let(:operator_class){ Extend }
it_should_behave_like("An operator class")
subject{ a_lispy.extend(an_operand, :big => lambda{ tested > 10 }) }
it{ should be_a(Extend) }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_group.rb | Ruby | mit | 49 | master | 660 | require 'spec_helper'
module Alf
module Algebra
describe Group do
let(:operator_class){ Group }
it_should_behave_like("An operator class")
context "--no-allbut" do
subject{ a_lispy.group(an_operand, [:time, :b], :as) }
it { should be_a(Group) }
it 'is !allbut by defa... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/test_intersect.rb | Ruby | mit | 49 | master | 283 | require 'spec_helper'
module Alf
module Algebra
describe Intersect do
let(:operator_class){ Intersect }
it_should_behave_like("An operator class")
subject{ a_lispy.intersect(an_operand, an_operand) }
it { should be_a(Intersect) }
end
end
end |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/page/test_type_check.rb | Ruby | mit | 49 | master | 1,093 | require 'type_check_helper'
module Alf
module Algebra
describe Page, 'type_check' do
subject{ op.type_check }
context 'when ok' do
let(:op){
page(suppliers, [], 1, page_size: 12)
}
it{ should eq(op.heading) }
end
context 'when negative page index' do
... |
github | alf-tool/alf-core | https://github.com/alf-tool/alf-core | spec/unit/alf-algebra/operator/rank/test_keys.rb | Ruby | mit | 49 | master | 799 | require 'spec_helper'
module Alf
module Algebra
describe Rank, 'keys' do
let(:operand){
an_operand.with_heading(id: Integer, name: String, hobby: Tuple[name: String]).with_keys([:id])
}
subject{ op.keys }
context 'when the order relation does not contain a key' do
let(:o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.