Skip to content

Commit

Permalink
spec surrogate op
Browse files Browse the repository at this point in the history
  • Loading branch information
asaf schers committed Jul 8, 2017
1 parent c81d5b7 commit 434cec6
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions spec/predicates/compound_predicate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe CompoundPredicate do

context 'evaluates and' do
let (:pred_string) { p <<-XML
let (:pred_string) { <<-XML
<CompoundPredicate booleanOperator="and"><True /><SimplePredicate field="f" operator="lessOrEqual" value="16.0918513223731" /></CompoundPredicate>
XML
}
Expand All @@ -20,7 +20,7 @@
end

context 'evaluates or' do
let (:pred_string) { p <<-XML
let (:pred_string) { <<-XML
<CompoundPredicate booleanOperator="or"><False /><SimplePredicate field="f" operator="lessOrEqual" value="16.0918513223731" /></CompoundPredicate>
XML
}
Expand All @@ -38,5 +38,21 @@

context 'evaluates surrogate' do

context 'simple predicate' do
let (:pred_string) { <<-XML
<CompoundPredicate booleanOperator="surrogate"><SimplePredicate field="f" operator="lessOrEqual" value="16.0918513223731" /><False /></CompoundPredicate>
XML
}
let (:pred_xml) { Nokogiri::XML(pred_string); }
let (:predicate) { CompoundPredicate.new(pred_xml.children.first) }

it 'missing' do
expect(predicate.true?(g: 17)).to eq false
end

it 'not missing' do
expect(predicate.true?(f: 16)).to eq true
end
end
end
end

0 comments on commit 434cec6

Please sign in to comment.