trabajo-afectivo/spec/models/object_manager/attribute/validation/backend_examples.rb

26 lines
781 B
Ruby
Raw Normal View History

2022-01-01 13:38:12 +00:00
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
require 'rails_helper'
RSpec.shared_examples 'a validation without errors' do
it 'validatates without errors' do
allow(subject).to receive(:value).and_return(value) # rubocop:disable RSpec/SubjectStub
subject.validate
expect(record.errors).to be_blank
end
end
RSpec.shared_examples 'a validation with errors' do
it 'validates with errors' do
allow(subject).to receive(:value).and_return(value) # rubocop:disable RSpec/SubjectStub
subject.validate
expect(record.errors).to be_present
end
end
RSpec.shared_examples 'validate backend' do
it 'included in backends list' do
expect(::ObjectManager::Attribute::Validation.backends).to include(described_class)
end
end