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-predicate/nodes/qualified_identifier/test_qualifier.rb
Ruby
mit
49
master
238
require 'spec_helper' module Alf class Predicate describe QualifiedIdentifier, "qualified" do let(:expr){ Factory.qualified_identifier(:t, :id) } subject{ expr.qualifier } it{ should eq(:t) } end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/nodes/qualified_identifier/test_free_variables.rb
Ruby
mit
49
master
259
require 'spec_helper' module Alf class Predicate describe QualifiedIdentifier, "free_variables" do let(:expr){ Factory.qualified_identifier(:t, :id) } subject{ expr.free_variables } it{ should eq(AttrList[:id]) } end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/nodes/identifier/test_free_variables.rb
Ruby
mit
49
master
235
require 'spec_helper' module Alf class Predicate describe Identifier, "free_variables" do let(:expr){ Factory.identifier(:id) } subject{ expr.free_variables } it{ should eq(AttrList[:id]) } end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/nodes/identifier/test_name.rb
Ruby
mit
49
master
205
require 'spec_helper' module Alf class Predicate describe Identifier, "name" do let(:expr){ Factory.identifier(:id) } subject{ expr.name } it{ should eq(:id) } end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/nodes/identifier/test_and_split.rb
Ruby
mit
49
master
519
require 'spec_helper' module Alf class Predicate describe Identifier, "and_split" do let(:predicate){ Factory.identifier(:id) } let(:tautology){ Factory.tautology } subject{ predicate.and_split(list) } context 'when included' do let(:list){ AttrList[:id, :name] } it{...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/predicate/test_to_ruby_code.rb
Ruby
mit
49
master
458
require 'spec_helper' module Alf class Predicate describe Predicate, "to_ruby_code" do subject{ p.to_ruby_code } describe "on a comp(:eq)" do let(:p){ Predicate.coerce(:x => 2) } it{ should eq("->(t){ t.x == 2 }") } end describe "with qualified identifiers" do l...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/predicate/test_rename.rb
Ruby
mit
49
master
2,202
require 'spec_helper' module Alf class Predicate describe Predicate, "rename" do let(:p){ Predicate } subject{ predicate.rename(renaming) } context 'on a pure Renaming' do let(:renaming) { Renaming[:x => :z] } context 'on a full AST predicate' do let(:predicate){ p....
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/predicate/test_free_variables.rb
Ruby
mit
49
master
284
require 'spec_helper' module Alf class Predicate describe Predicate, "free_variables" do subject{ p.free_variables } describe "on a comp(:eq)" do let(:p){ Predicate.coerce(:x => 2) } it{ should eq(AttrList[:x]) } end end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/predicate/test_hash_and_equal.rb
Ruby
mit
49
master
582
require 'spec_helper' module Alf class Predicate describe Predicate, "hash and ==" do subject{ left == right } after do left.hash.should eq(right.hash) if subject end describe "on equal predicates" do let(:left) { Predicate.coerce(:x => 2) } let(:right){ Predicat...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/predicate/test_bool_and.rb
Ruby
mit
49
master
703
require 'spec_helper' module Alf class Predicate describe Predicate, "&" do let(:left) { Predicate.coerce(x: 2) } subject{ left & right } before do subject.should be_a(Predicate) end context 'with itself' do let(:right){ left } it{ should be(left) } ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/predicate/test_tautology.rb
Ruby
mit
49
master
486
require 'spec_helper' module Alf class Predicate describe Predicate, "tautology?" do subject{ pred.tautology? } context "tautology" do subject{ Predicate.tautology } it{ should be_true } end context "contradiction" do subject{ Predicate.contradiction } ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/predicate/test_evaluate.rb
Ruby
mit
49
master
1,657
require 'spec_helper' module Alf class Predicate describe Predicate, "evaluate" do subject{ predicate.evaluate(scope) } context 'on a native predicate of arity 1, used through tuple#[]' do let(:predicate){ Predicate.native(->(t){ t[:name] =~ /foo/ }) } context 'on ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/predicate/test_contradiction.rb
Ruby
mit
49
master
494
require 'spec_helper' module Alf class Predicate describe Predicate, "contradiction?" do subject{ pred.contradiction? } context "tautology" do subject{ Predicate.tautology } it{ should be_false } end context "contradiction" do subject{ Predicate.contradiction } ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/predicate/test_constant_variables.rb
Ruby
mit
49
master
1,229
require 'spec_helper' module Alf class Predicate describe Predicate, "constant_variables" do subject{ p.constant_variables } describe "on a comp(:eq)" do let(:p){ Predicate.coerce(x: 2, y: 3) } it{ should eq(AttrList[:x, :y]) } end describe "on a in with one value" do ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/predicate/test_bool_or.rb
Ruby
mit
49
master
703
require 'spec_helper' module Alf class Predicate describe Predicate, "|" do let(:left) { Predicate.coerce(x: 2) } subject{ left | right } before do subject.should be_a(Predicate) end context 'with itself' do let(:right){ left } it{ should be(left) } ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/predicate/test_to_ruby_literal.rb
Ruby
mit
49
master
293
require 'spec_helper' module Alf class Predicate describe Predicate, "to_ruby_literal" do subject{ p.to_ruby_literal } describe "on a comp(:eq)" do let(:p){ Predicate.coerce(:x => 2) } it{ should eq("->(t){ t.x == 2 }") } end end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/predicate/test_coerce.rb
Ruby
mit
49
master
2,948
require 'spec_helper' module Alf class Predicate describe Predicate, ".coerce" do subject{ Predicate.coerce(arg) } describe "from Predicate" do let(:arg){ Predicate.new(Factory.tautology) } it{ should be(arg) } end describe "from true" do let(:arg){ true } ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/predicate/test_bool_not.rb
Ruby
mit
49
master
1,448
require 'spec_helper' module Alf class Predicate describe Predicate, "!" do subject{ !pred } context "on tautology" do let(:pred){ Predicate.tautology } it{ should eq(Predicate.contradiction) } end context "on contradiction" do let(:pred){ Predicate.contradictio...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/predicate/test_to_proc.rb
Ruby
mit
49
master
264
require 'spec_helper' module Alf class Predicate describe Predicate, "to_proc" do subject{ p.to_proc } describe "on a comp(:eq)" do let(:p){ Predicate.coerce(:x => 2) } it{ should be_a(Proc) } end end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/predicate/test_and_split.rb
Ruby
mit
49
master
1,241
require 'spec_helper' module Alf class Predicate describe Predicate, "and_split" do let(:p){ Predicate } subject{ pred.and_split(AttrList[:x]) } context "on tautology" do let(:pred){ p.tautology } it{ should eq([p.tautology, p.tautology]) } end context "on contrad...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/predicate/test_qualify.rb
Ruby
mit
49
master
871
require 'spec_helper' module Alf class Predicate describe Predicate, "qualify" do let(:p){ Predicate } subject{ predicate.qualify(qualifier) } let(:qualifier) { {:x => :t} } context 'on a full AST predicate' do let(:predicate){ p.in(:x, [2]) & p.eq(:y, 3) } it{ should ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/predicate/test_factory_methods.rb
Ruby
mit
49
master
1,821
require 'spec_helper' module Alf class Predicate describe Predicate, "factory methods" do before do subject.should be_a(Predicate) subject.expr.should be_a(Expr) end context "tautology" do subject{ Predicate.tautology } specify{ subject.to_ruby_code.should eq("...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/expr/test_to_ruby_code.rb
Ruby
mit
49
master
3,245
require 'spec_helper' module Alf class Predicate describe Expr, "to_ruby_code" do let(:f){ Factory } subject{ expr.to_ruby_code } after do unless expr.is_a?(Native) lambda{ eval(subject) }.should_not raise_error end end context 'tau...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/expr/test_to_proc.rb
Ruby
mit
49
master
276
require 'spec_helper' module Alf class Predicate describe Expr, "to_proc" do let(:expr){ Factory.lte(:x, 2) } subject{ expr.to_proc } it{ should be_a(Proc) } it 'has arity 1' do subject.arity.should eq(1) end end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/factory/test_qualified_identifier.rb
Ruby
mit
49
master
373
require_relative 'shared/a_predicate_ast_node' module Alf class Predicate describe Factory, 'qualified_identifier' do include Factory subject{ qualified_identifier(:t, :name) } it_should_behave_like "a predicate AST node" it{ should be_a(QualifiedIdentifier) } it{ should eql([:qu...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/factory/test_contradiction.rb
Ruby
mit
49
master
280
require_relative 'shared/a_predicate_ast_node' module Alf class Predicate describe Factory, 'contradiction' do include Factory subject{ contradiction } it_should_behave_like "a predicate AST node" it{ should be_a(Contradiction) } end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/factory/test_lt.rb
Ruby
mit
49
master
245
require_relative "shared/a_comparison_factory_method" module Alf class Predicate describe Factory, 'lt' do let(:method){ :lt } let(:node_class){ Lt } it_should_behave_like "a comparison factory method" end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/factory/test_literal.rb
Ruby
mit
49
master
306
require_relative 'shared/a_predicate_ast_node' module Alf class Predicate describe Factory, 'literal' do include Factory subject{ literal(12) } it_should_behave_like "a predicate AST node" it{ should be_a(Literal) } it{ should eql([:literal, 12]) } end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/factory/test_in.rb
Ruby
mit
49
master
259
require_relative "shared/a_comparison_factory_method" module Alf class Predicate describe Factory, 'in' do subject{ Factory.in(:x, [2, 3]) } it{ should be_a(In) } it{ should eq([:in, [:identifier, :x], [2, 3]]) } end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/factory/test_identifier.rb
Ruby
mit
49
master
324
require_relative 'shared/a_predicate_ast_node' module Alf class Predicate describe Factory, 'identifier' do include Factory subject{ identifier(:name) } it_should_behave_like "a predicate AST node" it{ should be_a(Identifier) } it{ should eql([:identifier, :name]) } end end ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/factory/test_gte.rb
Ruby
mit
49
master
248
require_relative "shared/a_comparison_factory_method" module Alf class Predicate describe Factory, 'gte' do let(:method){ :gte } let(:node_class){ Gte } it_should_behave_like "a comparison factory method" end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/factory/test_not.rb
Ruby
mit
49
master
304
require_relative 'shared/a_predicate_ast_node' module Alf class Predicate describe Factory, 'not' do include Factory subject{ self.not(true) } it_should_behave_like "a predicate AST node" it{ should be_a(Not) } it{ should eql([:not, tautology]) } end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/factory/test_factor_predicate.rb
Ruby
mit
49
master
918
require 'spec_helper' module Alf class Predicate describe Factory, "_factor_predicate" do subject{ Factory._factor_predicate(arg) } context "on Expr" do let(:arg){ Grammar.sexpr([:literal, 12]) } it{ should be(arg) } end context "on true" do let(:arg){ true } ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/factory/test_eq.rb
Ruby
mit
49
master
245
require_relative "shared/a_comparison_factory_method" module Alf class Predicate describe Factory, 'eq' do let(:method){ :eq } let(:node_class){ Eq } it_should_behave_like "a comparison factory method" end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/factory/test_between.rb
Ruby
mit
49
master
326
require_relative "shared/a_comparison_factory_method" module Alf class Predicate describe Factory, 'between' do subject{ Factory.between(:x, 2, 3) } it{ should be_a(And) } it{ should eq([:and, [:gte, [:identifier, :x], [:literal, 2]], [:lte, [:identifier, :x], [:literal, 3]]]) } end en...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/factory/test_tautology.rb
Ruby
mit
49
master
269
require_relative 'shared/a_predicate_ast_node' module Alf class Predicate describe Factory, 'tautology' do include Factory subject{ tautology } it_should_behave_like "a predicate AST node" it{ should be_a(Tautology) } end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/factory/test_gt.rb
Ruby
mit
49
master
245
require_relative "shared/a_comparison_factory_method" module Alf class Predicate describe Factory, 'gt' do let(:method){ :gt } let(:node_class){ Gt } it_should_behave_like "a comparison factory method" end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/factory/test_or.rb
Ruby
mit
49
master
317
require_relative 'shared/a_predicate_ast_node' module Alf class Predicate describe Factory, 'or' do include Factory subject{ self.or(true, true) } it_should_behave_like "a predicate AST node" it{ should be_a(Or) } it{ should eql([:or, tautology, tautology]) } end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/factory/test_native.rb
Ruby
mit
49
master
383
require_relative 'shared/a_predicate_ast_node' module Alf class Predicate describe Factory, 'native' do include Factory subject{ native(proc) } context 'with a proc' do let(:proc){ ->{} } it_should_behave_like "a predicate AST node" it{ should be_a(Native) } ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/factory/test_neq.rb
Ruby
mit
49
master
248
require_relative "shared/a_comparison_factory_method" module Alf class Predicate describe Factory, 'neq' do let(:method){ :neq } let(:node_class){ Neq } it_should_behave_like "a comparison factory method" end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/factory/test_and.rb
Ruby
mit
49
master
321
require_relative 'shared/a_predicate_ast_node' module Alf class Predicate describe Factory, 'and' do include Factory subject{ self.and(true, true) } it_should_behave_like "a predicate AST node" it{ should be_a(And) } it{ should eql([:and, tautology, tautology]) } end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/factory/test_lte.rb
Ruby
mit
49
master
248
require_relative "shared/a_comparison_factory_method" module Alf class Predicate describe Factory, 'lte' do let(:method){ :lte } let(:node_class){ Lte } it_should_behave_like "a comparison factory method" end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/factory/test_comp.rb
Ruby
mit
49
master
904
require_relative 'shared/a_predicate_ast_node' module Alf class Predicate describe Factory, 'comp' do subject{ Factory.comp(:eq, h) } context "when the hash is empty" do let(:h){ {} } it{ should eq(Factory.tautology) } end context "when the hash is singleton" do ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/factory/shared/a_comparison_factory_method.rb
Ruby
mit
49
master
933
require_relative 'a_predicate_ast_node' shared_examples_for "a comparison factory method" do include Alf::Predicate::Factory context 'with two operands' do subject{ self.send(method, true, true) } it_should_behave_like "a predicate AST node" it{ should be_a(node_class) } it{ should eql([method, ta...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-predicate/factory/shared/a_predicate_ast_node.rb
Ruby
mit
49
master
467
require 'spec_helper' shared_examples_for "a predicate AST node" do it{ should be_a(Sexpr) } it{ should be_a(Alf::Predicate::Expr) } specify{ (subject.tautology? == subject.is_a?(Alf::Predicate::Tautology)).should be_true } specify{ (subject.contradiction? == subject.is_a?(Alf::Predicate::Contradi...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/inserter/test_compact.rb
Ruby
mit
49
master
454
require 'update_helper' module Alf module Update describe Inserter, 'compact' do let(:expr) { compact(suppliers) } let(:inserted) { [ {:name => "Jones"} ] } let(:expected) { [ {:name => "Jones"} ] } subject{ insert(expr, inserted) } it 'requests the insertion of the tuples on ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/inserter/test_group.rb
Ruby
mit
49
master
686
require 'update_helper' module Alf module Update describe Inserter, 'group' do let(:expr) { group(suppliers, [:foo], :bar) } let(:inserted) { [ {:name => "Jones", :bar => Relation(:foo => [12, 13]) }, {:name => "Smith", :bar => Relation(:foo => [15]) } ] } let(:exp...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/inserter/test_restrict.rb
Ruby
mit
49
master
517
require 'update_helper' module Alf module Update describe Inserter, 'restrict' do let(:expr) { restrict(suppliers, :name => "Jones") } let(:inserted) { [ { :name => "Jones", :city => "London" } ] } let(:expected) { [ { :name => "Jones", :city => "London" } ] } subject{ insert(expr, i...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/inserter/test_not_matching.rb
Ruby
mit
49
master
460
require 'update_helper' module Alf module Update describe Inserter, 'not_matching' do let(:expr) { not_matching(suppliers, parts) } let(:inserted) { [ {:sid => 1 } ] } let(:expected) { [ {:sid => 1 } ] } subject{ insert(expr, inserted) } it 'requests the insertion of the tuple...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/inserter/test_clip.rb
Ruby
mit
49
master
507
require 'update_helper' module Alf module Update describe Inserter, 'clip' do let(:expr) { clip(suppliers, [:name]) } let(:inserted) { [ {:name => "Jones"} ] } let(:expected) { [ {:name => "Jones"} ] } subject{ insert(expr, inserted) } it 'requests the insertion of the tup...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/inserter/test_extend.rb
Ruby
mit
49
master
528
require 'update_helper' module Alf module Update describe Inserter, 'defaults' do let(:expr) { extend(suppliers, :foo => lambda{ 12 }) } let(:inserted) { [ {:name => "Jones", :foo => 13}, {:name => "Smith"} ] } let(:expected) { [ {:name => "Jones"}, {:name => "Smith"} ] } subject{ in...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/inserter/test_rank.rb
Ruby
mit
49
master
496
require 'update_helper' module Alf module Update describe Inserter, 'rank' do let(:expr) { rank(suppliers, [[:name, :asc]], :rank) } let(:inserted) { [ {:rank => 1, :name => "Jones"} ] } let(:expected) { [ {:name => "Jones"} ] } subject{ insert(expr, inserted) } it...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/inserter/test_union.rb
Ruby
mit
49
master
555
require 'update_helper' module Alf module Update describe Inserter, 'union' do let(:expr) { union(suppliers, parts) } let(:inserted) { [ {:name => "Jones"}, {:name => "Smith"} ] } let(:expected) { [ {:name => "Jones"}, {:name => "Smith"} ] } subject{ insert(expr, inserted) } i...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/inserter/test_sort.rb
Ruby
mit
49
master
506
require 'update_helper' module Alf module Update describe Inserter, 'sort' do let(:expr) { sort(suppliers, [[:name, :desc]]) } let(:inserted) { [ {:name => "Jones"}, {:name => "Smith"} ] } let(:expected) { [ {:name => "Smith"}, {:name => "Jones"} ] } subject{ insert(expr, inserted) }...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/inserter/test_matching.rb
Ruby
mit
49
master
452
require 'update_helper' module Alf module Update describe Inserter, 'matching' do let(:expr) { matching(suppliers, parts) } let(:inserted) { [ {:sid => 1 } ] } let(:expected) { [ {:sid => 1 } ] } subject{ insert(expr, inserted) } it 'requests the insertion of the tuples on :su...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/inserter/test_rename.rb
Ruby
mit
49
master
508
require 'update_helper' module Alf module Update describe Inserter, 'rename' do let(:expr) { rename(suppliers, :name => :nome) } let(:inserted) { [ {:nome => "Jones"}, {:nome => "Smith"} ] } let(:expected) { [ {:name => "Jones"}, {:name => "Smith"} ] } subject{ insert(expr, inserted)...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/inserter/test_minus.rb
Ruby
mit
49
master
446
require 'update_helper' module Alf module Update describe Inserter, 'minus' do let(:expr) { minus(suppliers, parts) } let(:inserted) { [ {:sid => 1 } ] } let(:expected) { [ {:sid => 1 } ] } subject{ insert(expr, inserted) } it 'requests the insertion of the tuples on :supplier...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/inserter/test_identifier.rb
Ruby
mit
49
master
405
require 'update_helper' module Alf module Update describe Inserter, 'identifier' do let(:expr) { suppliers } let(:inserted) { [ {:id => 1} ] } subject{ insert(expr, inserted) } it 'requests the insertion of the tuples on :suppliers' do subject db_context...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/inserter/test_project.rb
Ruby
mit
49
master
513
require 'update_helper' module Alf module Update describe Inserter, 'project' do let(:expr) { project(suppliers, [:name]) } let(:inserted) { [ {:name => "Jones"} ] } let(:expected) { [ {:name => "Jones"} ] } subject{ insert(expr, inserted) } it 'requests the insertion of t...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/inserter/test_autonum.rb
Ruby
mit
49
master
494
require 'update_helper' module Alf module Update describe Inserter, 'autonum' do let(:expr) { autonum(suppliers, :auto) } let(:inserted) { [ {:auto => 1, :name => "Jones"} ] } let(:expected) { [ {:name => "Jones"} ] } subject{ insert(expr, inserted) } it '...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/inserter/test_defaults.rb
Ruby
mit
49
master
544
require 'update_helper' module Alf module Update describe Inserter, 'defaults' do let(:expr) { defaults(suppliers, :foo => 12) } let(:inserted) { [ {:name => "Jones", :foo => 13}, {:name => "Smith"} ] } let(:expected) { [ {:name => "Jones", :foo => 13}, {:name => "Smith", :foo => 12} ] } ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/inserter/test_wrap.rb
Ruby
mit
49
master
616
require 'update_helper' module Alf module Update describe Inserter, 'wrap' do let(:expr) { wrap(suppliers, [:foo], :bar) } let(:inserted) { [ {:name => "Jones", :bar => {:foo => 12} }, {:name => "Smith", :bar => {:foo => 15} } ] } let(:expected) { [ {:name => "...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/inserter/test_join.rb
Ruby
mit
49
master
489
require 'update_helper' module Alf module Update describe Inserter, 'join' do let(:expr) { join(suppliers, parts) } let(:inserted) { [ {:sid => 1, :pid => 2} ] } subject{ insert(expr, inserted) } it 'requests the insertion of the tuples on :suppliers' do subject db_c...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/inserter/test_intersect.rb
Ruby
mit
49
master
563
require 'update_helper' module Alf module Update describe Inserter, 'intersect' do let(:expr) { intersect(suppliers, parts) } let(:inserted) { [ {:name => "Jones"}, {:name => "Smith"} ] } let(:expected) { [ {:name => "Jones"}, {:name => "Smith"} ] } subject{ insert(expr, inserted) } ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/deleter/test_identifier.rb
Ruby
mit
49
master
455
require 'update_helper' module Alf module Update describe Deleter, 'identifier' do let(:expr) { suppliers } let(:inserted) { [ {:id => 1} ] } let(:predicate){ Predicate.eq(:id, 1) } subject{ delete(expr, predicate) } it 'requests the deletion of the tuples on ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/deleter/test_restrict.rb
Ruby
mit
49
master
563
require 'update_helper' module Alf module Update describe Inserter, 'restrict' do let(:r_predicate){ Predicate.eq(:name, "Jones") } let(:expr) { restrict(suppliers, r_predicate) } let(:d_predicate){ Predicate.eq(:city, "London") } let(:anded) { Predicate.eq(:name => "Jon...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/deleter/test_wrap.rb
Ruby
mit
49
master
691
require 'update_helper' module Alf module Update describe Deleter, 'wrap' do let(:expr){ wrap(suppliers, [:city], :foo) } subject{ delete(expr, predicate) } context 'pass-through' do let(:predicate){ Predicate.eq(:id => 1) } it 'requests the deletion on :suppliers' do ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/deleter/test_rename.rb
Ruby
mit
49
master
716
require 'update_helper' module Alf module Update describe Deleter, 'rename' do let(:expr){ rename(suppliers, :city => :location) } subject{ delete(expr, predicate) } context 'pass-through' do let(:predicate){ Predicate.eq(:id => 1) } it 'requests the deletion on :suppliers' d...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/deleter/test_sort.rb
Ruby
mit
49
master
411
require 'update_helper' module Alf module Update describe Deleter, 'sort' do let(:expr) { sort(suppliers, [[:name, :asc]]) } let(:predicate){ Predicate.eq(:name => "Jones") } subject{ delete(expr, predicate) } it 'requests the deletion on :suppliers' do subject db_co...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/deleter/test_group.rb
Ruby
mit
49
master
693
require 'update_helper' module Alf module Update describe Deleter, 'group' do let(:expr){ group(suppliers, [:city], :foo) } subject{ delete(expr, predicate) } context 'pass-through' do let(:predicate){ Predicate.eq(:id => 1) } it 'requests the deletion on :suppliers' do ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/deleter/test_intersect.rb
Ruby
mit
49
master
490
require 'update_helper' module Alf module Update describe Deleter, 'intersect' do let(:expr) { intersect(suppliers, parts) } let(:predicate){ Predicate.eq(:city => "London") } subject{ delete(expr, predicate) } it 'requests the deletion on both :suppliers and :parts' do ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/deleter/test_rank.rb
Ruby
mit
49
master
701
require 'update_helper' module Alf module Update describe Deleter, 'rank' do let(:expr){ rank(suppliers, [[:name, :asc]], :rank) } subject{ delete(expr, predicate) } context 'pass-through' do let(:predicate){ Predicate.eq(:id => 1) } it 'requests the deletion on :suppliers' d...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/deleter/test_defaults.rb
Ruby
mit
49
master
706
require 'update_helper' module Alf module Update describe Deleter, 'defaults' do let(:expr){ defaults(suppliers, :foo => lambda{ 12 }) } subject{ delete(expr, predicate) } context 'pass-through' do let(:predicate){ Predicate.eq(:id => 1) } it 'requests the deletion on :suppli...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/deleter/test_extend.rb
Ruby
mit
49
master
702
require 'update_helper' module Alf module Update describe Deleter, 'extend' do let(:expr){ extend(suppliers, :foo => lambda{ 12 }) } subject{ delete(expr, predicate) } context 'pass-through' do let(:predicate){ Predicate.eq(:id => 1) } it 'requests the deletion on :suppliers'...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/deleter/test_autonum.rb
Ruby
mit
49
master
690
require 'update_helper' module Alf module Update describe Deleter, 'autonum' do let(:expr){ autonum(suppliers, :auto) } subject{ delete(expr, predicate) } context 'pass-through' do let(:predicate){ Predicate.eq(:id => 1) } it 'requests the deletion on :suppliers' do ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/deleter/test_clip.rb
Ruby
mit
49
master
403
require 'update_helper' module Alf module Update describe Deleter, 'clip' do let(:expr) { clip(suppliers, [:name]) } let(:predicate){ Predicate.eq(:name => "Jones") } subject{ delete(expr, predicate) } it 'requests the deletion on :suppliers' do subject db_context.re...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/deleter/test_project.rb
Ruby
mit
49
master
409
require 'update_helper' module Alf module Update describe Deleter, 'project' do let(:expr) { project(suppliers, [:name]) } let(:predicate){ Predicate.eq(:name => "Jones") } subject{ delete(expr, predicate) } it 'requests the deletion on :suppliers' do subject db_cont...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-update/updater/test_identifier.rb
Ruby
mit
49
master
476
require 'update_helper' module Alf module Update describe Updater, 'identifier' do let(:expr) { suppliers } let(:updating) { {:city => "London"} } let(:predicate){ Predicate.eq(:id, 1) } subject{ update(expr, updating, predicate) } it 'requests the insertion of the...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-aggregator/test_concat.rb
Ruby
mit
49
master
1,130
require 'spec_helper' module Alf class Aggregator describe Concat do let(:rel){[ {:qty => 10}, {:qty => 20}, {:qty => 30}, {:qty => 40} ]} it 'should work when used standalone' do Concat.new{ qty }.aggregate([]).should eq("") Concat.new{ qty }.a...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-aggregator/test_sum.rb
Ruby
mit
49
master
486
require 'spec_helper' module Alf class Aggregator describe Sum do let(:rel){[ {:qty => 10}, {:qty => 20} ]} it 'should work when used standalone' do Sum.new{ qty }.aggregate([]).should eq(0) Sum.new{ qty }.aggregate(rel).should eq(30) end it 'shoul...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-aggregator/test_stddev.rb
Ruby
mit
49
master
590
require 'spec_helper' module Alf class Aggregator describe Stddev do let(:rel){[ {:qty => 10}, {:qty => 20}, {:qty => 30}, {:qty => 40} ]} let(:expected) { Math.sqrt(Variance.new{qty}.aggregate(rel)) } it 'should work when used standalone' d...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-aggregator/test_collect.rb
Ruby
mit
49
master
577
require 'spec_helper' module Alf class Aggregator describe Collect do let(:rel){[ {:qty => 10}, {:qty => 20}, {:qty => 30}, {:qty => 40} ]} it 'should work when used standalone' do Collect.new{ qty }.aggregate([]).should eq([]) Collect.new{ qty ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-aggregator/test_max.rb
Ruby
mit
49
master
487
require 'spec_helper' module Alf class Aggregator describe Max do let(:rel){[ {:qty => 10}, {:qty => 0} ]} it 'should work when used standalone' do Max.new{ qty }.aggregate([]).should eq(nil) Max.new{ qty }.aggregate(rel).should eq(10) end it 'shou...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-aggregator/test_min.rb
Ruby
mit
49
master
485
require 'spec_helper' module Alf class Aggregator describe Min do let(:rel){[ {:qty => 10}, {:qty => 0} ]} it 'should work when used standalone' do Min.new{ qty }.aggregate([]).should eq(nil) Min.new{ qty }.aggregate(rel).should eq(0) end it 'shoul...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-aggregator/test_variance.rb
Ruby
mit
49
master
701
require 'spec_helper' module Alf class Aggregator describe Variance do let(:rel){[ {:qty => 10}, {:qty => 20}, {:qty => 30}, {:qty => 40} ]} let(:expected) { vals = rel.map{|t| t[:qty]} mean = vals.inject(:+) / vals.size.to_f vals.collect...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-aggregator/test_avg.rb
Ruby
mit
49
master
437
require 'spec_helper' module Alf class Aggregator describe Avg do let(:rel){[ {:qty => 10}, {:qty => 1} ]} it 'should work when used standalone' do Avg.new{ qty }.aggregate(rel).should eq(5.5) end it 'should install factory methods' do Aggregator.a...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-aggregator/test_count.rb
Ruby
mit
49
master
344
require 'spec_helper' module Alf class Aggregator describe Count do it 'should work when used standalone' do Count.new.aggregate([]).should eq(0) Count.new.aggregate([{}]).should eq(1) end it 'should install factory methods' do Aggregator.count.should be_a(Count) ...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-adapter/shared_examples/an_uncached_connection_method.rb
Ruby
mit
49
master
527
shared_examples_for 'an uncached connection method' do let(:connection){ meth = connection_method Class.new(Alf::Adapter::Connection) do define_method(meth) do |*args, &bl| bl ? bl.call(args) : args end end.new(nil) } let(:cached){ Alf::Adapter::Connection::SchemaCached.new(connec...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-adapter/shared_examples/an_adapter.rb
Ruby
mit
49
master
784
shared_examples_for "an adapter" do describe 'connection' do subject{ adapter.connection } after { subject.close } it{ should be_a(Alf::Adapter::Connection) } end describe 'connect' do subject{ adapter.connect{|c| @seen = c} } it 'yields a connection object' do subject @s...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-adapter/shared_examples/a_cached_connection_method.rb
Ruby
mit
49
master
719
shared_examples_for 'a cached connection method' do let(:connection){ meth = connection_method Class.new(Alf::Adapter::Connection) do define_method(meth) do |name| raise unless @seen.nil? @seen = [ name ] end end.new(nil) } let(:cached) { Alf::Adapter::Connection::Sche...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-adapter/shared_examples/an_adapter_with_readable_cogs.rb
Ruby
mit
49
master
627
shared_examples_for "an adapter with readable cogs" do let(:connection){ adapter.connection } before do connection.should be_a(Alf::Adapter::Connection) end after do connection.close if connection end describe 'knows?' do it 'respond true to known cogs' do readable_cogs.each do |cog_n...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-adapter/shared_examples/an_adapter_class.rb
Ruby
mit
49
master
472
shared_examples_for "an adapter class" do describe 'recognizes?' do it 'returns true on recognized connection specifications' do recognized_conn_specs.each do |c| adapter_class.recognizes?(c).should be_true end end end describe 'new' do it 'returns an instance on recognized con...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-adapter/connection/test_migrate.rb
Ruby
mit
49
master
341
require 'spec_helper' module Alf class Adapter describe Connection, "migrate!" do let(:conn){ Connection.new(nil) } subject{ conn.migrate!(hello: "world") } it 'raises an NotSupportedError by default' do lambda{ subject }.should raise_error(NotSupportedError) en...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-adapter/connection/test_lock.rb
Ruby
mit
49
master
293
require 'spec_helper' module Alf class Adapter describe Connection, "lock" do let(:conn){ Connection.new(nil) } subject{ conn.lock(:name, :exclusive){ @seen = true } } it 'yields the block' do subject @seen.should be_true end end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-adapter/connection/schema_cached/test_keys.rb
Ruby
mit
49
master
238
require 'spec_helper' module Alf class Adapter class Connection describe SchemaCached, "keys" do let(:connection_method){ :keys } it_should_behave_like 'a cached connection method' end end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-adapter/connection/schema_cached/test_knows.rb
Ruby
mit
49
master
242
require 'spec_helper' module Alf class Adapter class Connection describe SchemaCached, "knows?" do let(:connection_method){ :knows? } it_should_behave_like 'a cached connection method' end end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-adapter/connection/schema_cached/test_heading.rb
Ruby
mit
49
master
244
require 'spec_helper' module Alf class Adapter class Connection describe SchemaCached, "heading" do let(:connection_method){ :heading } it_should_behave_like 'a cached connection method' end end end end
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-adapter/connection/schema_cached/test_delegate.rb
Ruby
mit
49
master
333
require 'spec_helper' module Alf class Adapter class Connection [ :cog, :closed?, :close, :in_transaction ].each do |meth| describe SchemaCached, "#{meth}" do let(:connection_method){ meth.to_sym } it_should_behave_like 'an uncached connection method' end end e...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-adapter/adapter/test_factor.rb
Ruby
mit
49
master
346
require 'spec_helper' module Alf describe Adapter, ".factor" do subject{ Adapter.factor(conn_spec) } context "on a path" do let(:conn_spec){ Path.dir } it{ should be_a(Adapter::Folder) } end context "on an Adapter" do let(:conn_spec){ Adapter.new(nil) } it{ should be(conn_...
github
alf-tool/alf-core
https://github.com/alf-tool/alf-core
spec/unit/alf-viewpoint/test_members.rb
Ruby
mit
49
master
1,234
require 'spec_helper' module Alf describe Viewpoint, "members" do subject{ viewpoint.members } context 'on a base viewpoint' do let(:viewpoint){ Module.new{ include Alf::Viewpoint native :a_native_one def restricted restrict(a_native_one, id: 1) ...