base_factory_examples.rb 833 B

123456789101112131415161718192021222324252627
  1. require 'import/import_factory_examples'
  2. RSpec.shared_examples 'Import::BaseFactory' do
  3. it_behaves_like 'Import factory'
  4. it 'responds to pre_import_hook' do
  5. expect(described_class).to respond_to('pre_import_hook')
  6. end
  7. it 'responds to post_import_hook' do
  8. expect(described_class).to respond_to('post_import_hook')
  9. end
  10. it 'responds to backend_class' do
  11. expect(described_class).to respond_to('backend_class')
  12. end
  13. it 'responds to skip?' do
  14. expect(described_class).to respond_to('skip?')
  15. end
  16. end
  17. RSpec.shared_examples 'Import::BaseFactory extender' do
  18. it 'calls new on determined backend object' do
  19. record = double()
  20. expect(described_class).to receive(:backend_class).and_return(Class)
  21. expect(Class).to receive(:new).with(record, any_args)
  22. described_class.import([record])
  23. end
  24. end