From 19f5448e1a9761d4dfd079ac00f8b14196392f3c Mon Sep 17 00:00:00 2001 From: Martin Slemr Date: Mon, 27 Aug 2018 09:52:20 +0200 Subject: [PATCH] InventoryCollection's Builder exception message Adds message with suggestion of model_class. --- app/models/manageiq/providers/inventory/persister/builder.rb | 2 +- .../manageiq/providers/inventory/persister/builder_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/manageiq/providers/inventory/persister/builder.rb b/app/models/manageiq/providers/inventory/persister/builder.rb index 3e9d50320ac..c66df9b5c8d 100644 --- a/app/models/manageiq/providers/inventory/persister/builder.rb +++ b/app/models/manageiq/providers/inventory/persister/builder.rb @@ -80,7 +80,7 @@ def construct_data # Creates InventoryCollection def to_inventory_collection if @properties[:model_class].nil? && !@options[:without_model_class] - raise MissingModelClassError + raise MissingModelClassError, "Missing model_class for :#{@name} (\"#{@name.to_s.classify}\" or subclass expected)." end ::ManagerRefresh::InventoryCollection.new(to_hash) diff --git a/spec/models/manageiq/providers/inventory/persister/builder_spec.rb b/spec/models/manageiq/providers/inventory/persister/builder_spec.rb index d870815e4ac..49666bb4834 100644 --- a/spec/models/manageiq/providers/inventory/persister/builder_spec.rb +++ b/spec/models/manageiq/providers/inventory/persister/builder_spec.rb @@ -58,7 +58,7 @@ def create_persister it 'throws exception if model_class not specified' do builder = cloud.prepare_data(:non_existing_ic, persister_class) - expect { builder.to_inventory_collection }.to raise_error(::ManageIQ::Providers::Inventory::Persister::Builder::MissingModelClassError) + expect { builder.to_inventory_collection }.to raise_error(::ManageIQ::Providers::Inventory::Persister::Builder::MissingModelClassError, /NonExistingIc/) end # --- adv. settings (TODO: link to gui)---