spec/unit/rule/predicate_spec.rb in dry-logic-0.5.0 vs spec/unit/rule/predicate_spec.rb in dry-logic-0.6.0

- old
+ new

@@ -1,7 +1,7 @@ RSpec.describe Rule::Predicate do - subject(:rule) { Rule::Predicate.new(predicate) } + subject(:rule) { Rule::Predicate.build(predicate) } let(:predicate) { str? } include_context 'predicates' @@ -25,14 +25,14 @@ expect(email.(11).to_ast).to eql([:failure, [:email, [:predicate, [:str?, [[:input, 11]]]]]]) end end context 'with a result' do - it 'returns success ast' do - expect(rule.('foo').to_ast).to eql([:predicate, [:str?, [[:input, 'foo']]]]) + it 'returns success' do + expect(rule.('foo')).to be_success end - it 'returns ast' do + it 'returns failure ast' do expect(rule.(5).to_ast).to eql([:predicate, [:str?, [[:input, 5]]]]) end end context 'with a zero-arity predicate' do