Sha256: 4ba9201a04854f8a5ff8a1b081b672e739b9b81c55f52980feee7ec53dba2495
Contents?: true
Size: 1.4 KB
Versions: 70
Compression:
Stored size: 1.4 KB
Contents
require "rspec" require "vagrant-spec" module Vagrant module Spec class Components def initialize(paths) @paths = paths reload! end # Loads the components from the given paths def reload! # Delete the existing example groups RSpec.world.example_groups.clear @paths.each do |path| Dir.glob(File.join(path, "**/*_{output,spec}.rb")).each do |single| load single end end end # Returns the defined components that are runnable. # # @return [Array<String>] def components [].tap do |result| RSpec.world.example_groups.each do |group| next if !group.metadata.has_key?(:component) result << group.metadata[:component] end end end # Returns the defined provider features. def provider_features [].tap do |result| groups = RSpec.world.shared_example_group_registry.send(:shared_example_groups) groups[:main].each do |name, _| match = /^provider\/(.+?)$/.match(name) result << match[1] if match end end end protected # This loads the default components that are packaged with # the vagrant-spec gem. def self.load_default! load_from!(Vagrant::Spec.source_root.join("acceptance")) end end end end
Version data entries
70 entries across 21 versions & 1 rubygems