backend_examples.rb 717 B

12345678910111213141516171819202122232425
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.shared_examples 'a validation without errors' do
  4. it 'validatates without errors' do
  5. allow(subject).to receive(:value).and_return(value)
  6. subject.validate
  7. expect(record.errors).to be_blank
  8. end
  9. end
  10. RSpec.shared_examples 'a validation with errors' do
  11. it 'validates with errors' do
  12. allow(subject).to receive(:value).and_return(value)
  13. subject.validate
  14. expect(record.errors).to be_present
  15. end
  16. end
  17. RSpec.shared_examples 'validate backend' do
  18. it 'included in backends list' do
  19. expect(Validations::ObjectManager::AttributeValidator.backends).to include(described_class)
  20. end
  21. end