Skip to content

Commit

Permalink
compound predicate spec and/or
Browse files Browse the repository at this point in the history
  • Loading branch information
asaf schers committed Jul 8, 2017
1 parent 9d5a052 commit 560fd48
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions spec/predicates/compound_predicate_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,42 @@
require 'rspec'
require 'spec_helper'

describe CompoundPredicate do

it 'should do something' do
#true.should == false
context 'evaluates and' do
let (:pred_string) { p <<-XML
<CompoundPredicate booleanOperator="and"><True /><SimplePredicate field="f" operator="lessOrEqual" value="16.0918513223731" /></CompoundPredicate>
XML
}
let (:pred_xml) { Nokogiri::XML(pred_string); }
let (:predicate) { CompoundPredicate.new(pred_xml.children.first) }

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

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

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

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

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

context 'evaluates surrogate' do

end
end

0 comments on commit 560fd48

Please sign in to comment.