base_spec.rb 958 B

12345678910111213141516171819202122232425262728293031323334
  1. require 'rails_helper'
  2. RSpec.describe Import::Zendesk::ObjectAttribute::Base do
  3. it 'extends ObjectManager Attribute exception text' do
  4. attribute = double(
  5. title: 'Example attribute',
  6. description: 'Example attribute description',
  7. removable: false,
  8. active: true,
  9. position: 12,
  10. visible_in_portal: true,
  11. required_in_portal: true,
  12. required: true,
  13. type: 'input',
  14. )
  15. error_text = 'some error'
  16. expect(ObjectManager::Attribute).to receive(:add).and_raise(RuntimeError, error_text)
  17. exception = nil
  18. begin
  19. described_class.new('Ticket', 'example_field', attribute)
  20. rescue => e
  21. exception = e
  22. end
  23. expect(exception).not_to be nil
  24. expect(exception).to be_a(RuntimeError)
  25. expect(exception.message).to include(error_text)
  26. expect(exception.message).not_to eq(error_text)
  27. end
  28. end