spec/integration/custom_predicates_spec.rb in dry-validation-0.9.5 vs spec/integration/custom_predicates_spec.rb in dry-validation-0.10.0

- old
+ new

@@ -1,5 +1,6 @@ +# -*- coding: utf-8 -*- RSpec.describe Dry::Validation do shared_context 'uses custom predicates' do it 'uses provided custom predicates' do expect(schema.(email: 'jane@doe')).to be_success @@ -27,25 +28,25 @@ before do module Test module Predicates include Dry::Logic::Predicates - predicate(:email?) do |input| + def self.email?(input) input.include?('@') # for the lols end end end end context 'when configured globally' do - before do - Dry::Validation::Schema.predicates(Test::Predicates) - end - - subject!(:schema) do + subject(:schema) do Dry::Validation.Schema(base_class) do required(:email) { filled? & email? } end + end + + before do + Dry::Validation::Schema.predicates(Test::Predicates) end after do # HACK: reset global predicates configuration Dry::Validation::Schema.configure do |config|