spec/unit/rule/set_spec.rb in dry-logic-0.1.4 vs spec/unit/rule/set_spec.rb in dry-logic-0.2.0

- old
+ new

@@ -2,30 +2,28 @@ RSpec.describe Dry::Logic::Rule::Set do include_context 'predicates' subject(:rule) do - Dry::Logic::Rule::Set.new(:address, [is_string, min_size.curry(6)]) + Dry::Logic::Rule::Set.new([is_string, min_size.curry(6)]) end - let(:is_string) { Dry::Logic::Rule::Value.new(:name, str?) } - let(:min_size) { Dry::Logic::Rule::Value.new(:name, min_size?) } + let(:is_string) { Dry::Logic::Rule::Value.new(str?) } + let(:min_size) { Dry::Logic::Rule::Value.new(min_size?) } describe '#call' do it 'applies its rules to the input' do expect(rule.('Address')).to be_success expect(rule.('Addr')).to be_failure end end - describe '#to_ary' do + describe '#to_ast' do it 'returns an array representation' do - expect(rule).to match_array([ + expect(rule.to_ast).to eql([ :set, [ - :address, [ - [:val, [:name, [:predicate, [:str?, []]]]], - [:val, [:name, [:predicate, [:min_size?, [6]]]]] - ] + [:val, [:predicate, [:str?, []]]], + [:val, [:predicate, [:min_size?, [6]]]] ] ]) end end end