OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/modules/bim/spec/services/ifc_models/create_service_spec.rb

44 lines
1.1 KiB

require 'spec_helper'
require 'services/base_services/behaves_like_create_service'
describe Bim::IfcModels::CreateService do
it_behaves_like 'BaseServices create service' do
let(:model_class) { ::Bim::IfcModels::IfcModel }
let(:factory) { :ifc_model }
let(:conversion_job) do
double('ifc_conversion_job').tap do |job|
allow(job).to receive(:perform_later)
stub_const('Bim::IfcModels::IfcConversionJob', job)
end
end
it 'queues a conversion job' do
expect(conversion_job)
.to(receive(:perform_later))
.with(model_instance)
subject
end
context 'if the SetAttributeService is unsuccessful' do
let(:set_attributes_success) { false }
it 'queues no conversion job' do
expect(conversion_job).not_to receive(:perform_later)
subject
end
end
context 'when the model is invalid' do
let(:model_save_result) { false }
it 'queues no conversion job' do
expect(conversion_job).not_to receive(:perform_later)
subject
end
end
end
end