diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 84ce72a8ce4..dcf7d4832d0 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -54,10 +54,6 @@ def image_path(path, options = {}) config.example_status_persistence_file_path = Rails.root.join("tmp/rspec_example_store.txt") end - config.define_derived_metadata(:file_path => /spec\/lib\/miq_automation_engine\/models/) do |metadata| - metadata[:type] ||= :model - end - config.include UiConstants, :type => :view config.include UiConstants, :type => :controller diff --git a/spec/support/miq_ae_mock_object.rb b/spec/support/miq_ae_mock_object.rb deleted file mode 100644 index 86ab327168b..00000000000 --- a/spec/support/miq_ae_mock_object.rb +++ /dev/null @@ -1,26 +0,0 @@ -module Spec - module Support - class MiqAeMockObject - attr_reader :parent - def initialize(hash = {}) - @object_hash = HashWithIndifferentAccess.new(hash) - end - - def attributes - @object_hash - end - - def parent=(obj) - @parent = obj - end - - def [](attr) - @object_hash[attr.downcase] - end - - def []=(attr, value) - @object_hash[attr.downcase] = value - end - end - end -end diff --git a/spec/support/miq_ae_mock_service.rb b/spec/support/miq_ae_mock_service.rb deleted file mode 100644 index 48fb7d0be0c..00000000000 --- a/spec/support/miq_ae_mock_service.rb +++ /dev/null @@ -1,54 +0,0 @@ -MIQ_OK = 0 -MIQ_WARN = 4 -MIQ_ERROR = 8 -MIQ_STOP = 8 -MIQ_ABORT = 16 - -module Spec - module Support - class MiqAeMockService - include MiqAeMethodService::MiqAeServiceObjectCommon - include MiqAeMethodService::MiqAeServiceModelLegacy - - attr_reader :root, :object - attr_accessor :inputs - - def initialize(root, persist_state_hash = {}) - @root = root - @persist_state_hash = persist_state_hash - @inputs = {} - end - - def object=(obj) - @object = obj - end - - def set_state_var(name, value) - @persist_state_hash[name] = value - end - - def state_var_exist?(name) - @persist_state_hash.key?(name) - end - - def get_state_var(name) - @persist_state_hash[name] - end - - def log(level, msg) - $miq_ae_logger.send(level, " #{msg}") - end - - def vmdb(model_name, *args) - service = service_model(model_name) - args.empty? ? service : service.find(*args) - end - - def service_model(model_name) - "MiqAeMethodService::MiqAeService#{model_name}".constantize - rescue NameError - service_model_lookup(model_name) - end - end - end -end diff --git a/spec/support/miq_automate_helper.rb b/spec/support/miq_automate_helper.rb deleted file mode 100644 index 2b4a4aa93e0..00000000000 --- a/spec/support/miq_automate_helper.rb +++ /dev/null @@ -1,78 +0,0 @@ -module Spec - module Support - module MiqAutomateHelper - def self.create_dummy_method(identifiers, field_array) - @aed = FactoryGirl.create(:miq_ae_domain, :name => identifiers[:domain], - :priority => 10, :enabled => true, - :tenant => identifiers[:tenant]) - @aen1 = FactoryGirl.create(:miq_ae_namespace, :name => identifiers[:namespace], - :parent_id => @aed.id) - @aec1 = FactoryGirl.create(:miq_ae_class, :name => identifiers[:class], - :namespace_id => @aen1.id) - @aec1.ae_fields << build_fields(field_array) - @aei1 = FactoryGirl.create(:miq_ae_instance, :name => identifiers[:instance], - :class_id => @aec1.id) - @aem1 = FactoryGirl.create(:miq_ae_method, :class_id => @aec1.id, - :name => identifiers[:method], :scope => "instance", - :language => "ruby", :data => "puts 1", - :location => "inline") if identifiers[:method].present? - @aei1.ae_values << build_values(field_array, @aec1.ae_fields) - end - - def self.build_values(field_array, field_objects) - field_array.collect do |field| - field_obj = field_objects.detect { |f| f.name == field[:name] } - next unless field_obj - FactoryGirl.build(:miq_ae_value, :field_id => field_obj.id, :value => field[:value]) - end.compact - end - - def self.build_fields(field_array, aem_params = false) - field_array.collect do |field| - FactoryGirl.build(:miq_ae_field, - :name => field[:name], - :aetype => field[:type], - :priority => field[:priority], - :default_value => aem_params ? field[:value] : field[:default_value], - :substitute => true) - end - end - - def self.create_field(class_obj, instance_obj, method_obj, options) - if method_obj.nil? - field = FactoryGirl.create(:miq_ae_field, - :class_id => class_obj.id, - :name => options[:name], - :aetype => options[:type], - :priority => options[:priority], - :substitute => true) - create_field_value(instance_obj, field, options[:value]) unless options[:value].nil? - else - FactoryGirl.create(:miq_ae_field, - :method_id => method_obj.id, - :name => options[:name], - :aetype => options[:type], - :priority => options[:priority], - :substitute => true, - :default_value => options[:value]) - end - end - - def self.create_field_value(instance_obj, field_obj, value) - FactoryGirl.create(:miq_ae_value, - :instance_id => instance_obj.id, - :field_id => field_obj.id, - :value => value) - end - - def self.create_service_model_method(domain, namespace, klass, instance, method) - Tenant.seed - identifiers = {:domain => domain, :namespace => namespace, :tenant => Tenant.root_tenant, - :class => klass, :instance => instance, :method => method} - fields = [{:name => 'method1', :type => 'method', - :priority => 1, :value => method}] - create_dummy_method(identifiers, fields) - end - end - end -end