lib/rspec-system/node_set.rb in rspec-system-2.5.1 vs lib/rspec-system/node_set.rb in rspec-system-2.6.0

- old
+ new

@@ -3,15 +3,23 @@ class NodeSet # Returns a NodeSet object. # # @return [RSpecSystem::NodeSet::Base] returns an object based on the Base # abstract class. - def self.create(setname, config, virtual_env, custom_prefabs_path, options) + # @api private + def self.create + provider = RSpec.configuration.rs_provider + custom_prefabs = RSpec.configuration.rs_custom_prefabs + setname = RSpec.configuration.rs_set || RSpec.configuration.rs_config['default_set'] + options = {:destroy => RSpec.configuration.rs_destroy} + config = RSpec.configuration.rs_config['sets'][setname] + begin - require "rspec-system/node_set/#{virtual_env.downcase}" + require "rspec-system/node_set/#{provider.downcase}" rescue LoadError => e - raise "Unsupported virtual environment #{virtual_env}: #{e}" + raise "Unsupported provider #{provider}: #{e}" end - const_get(virtual_env.capitalize).new(setname, config, custom_prefabs_path, options) + class_name = provider.split("_").map {|v| v.capitalize }.join + const_get(class_name).new(setname, config, custom_prefabs, options) end end end