Sha256: 45f2dd039cfcc88adf3a9eefe12308e963aaddd007a875495bd94682a243d513
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
require 'spec_helper' module Alf module Engine describe Filter do subject{ Filter.new(operand, predicate).to_a } context 'on an empty operand' do let(:operand) { Leaf.new([]) } let(:predicate){ Predicate.coerce(true) } it{ should eq([]) } end context 'on a non-empty operand' do let(:operand){ Leaf.new [ {:name => "Jones"}, {:name => "Smith"} ] } let(:predicate){ Predicate.native(->(t){ t.name =~ /^J/ }) } let(:expected){ [ {:name => "Jones"}, ] } it{ should eq(expected) } end context 'on a predicate of arity 1' do let(:operand){ Leaf.new [ {:name => "Jones"}, {:name => "Smith"} ] } let(:predicate){ Predicate.native(->(t){ t[:name] =~ /^J/}) } let(:expected){ [ {:name => "Jones"}, ] } it{ should eq(expected) } end end end # module Engine end # module Alf
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alf-core-0.15.0 | spec/unit/alf-engine/test_filter.rb |