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