2016-11-25 16:10:37 +00:00
|
|
|
require 'import/import_factory_examples'
|
|
|
|
|
|
|
|
RSpec.shared_examples 'Import::BaseFactory' do
|
|
|
|
it_behaves_like 'Import factory'
|
|
|
|
|
|
|
|
it 'responds to pre_import_hook' do
|
|
|
|
expect(described_class).to respond_to('pre_import_hook')
|
|
|
|
end
|
2016-12-19 08:59:54 +00:00
|
|
|
it 'responds to post_import_hook' do
|
|
|
|
expect(described_class).to respond_to('post_import_hook')
|
|
|
|
end
|
2016-11-25 16:10:37 +00:00
|
|
|
it 'responds to backend_class' do
|
|
|
|
expect(described_class).to respond_to('backend_class')
|
|
|
|
end
|
|
|
|
it 'responds to skip?' do
|
|
|
|
expect(described_class).to respond_to('skip?')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
RSpec.shared_examples 'Import::BaseFactory extender' do
|
|
|
|
it 'calls new on determined backend object' do
|
|
|
|
record = double()
|
|
|
|
expect(described_class).to receive(:backend_class).and_return(Class)
|
2016-12-19 08:59:54 +00:00
|
|
|
expect(Class).to receive(:new).with(record, any_args)
|
2016-11-25 16:10:37 +00:00
|
|
|
described_class.import([record])
|
|
|
|
end
|
|
|
|
end
|