summaryrefslogtreecommitdiff
path: root/spec/support/resource_helpers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/resource_helpers.rb')
-rw-r--r--spec/support/resource_helpers.rb51
1 files changed, 0 insertions, 51 deletions
diff --git a/spec/support/resource_helpers.rb b/spec/support/resource_helpers.rb
deleted file mode 100644
index a4bc74e..0000000
--- a/spec/support/resource_helpers.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-class ProviderExampleGroup < Spec::Example::ExampleGroup
-
- attr_reader :resource
-
- before :each do
- resource_hash = example_group_hierarchy.inject({}) do |memo, klass|
- memo.merge(klass.options[:resource] || {})
- end
- full_hash = resource_hash.merge(:provider => described_class.name)
- @resource = described_class.resource_type.new(full_hash)
- end
-
- subject { described_class.new(@resource) }
- alias :provider :subject
-
- class << self
-
- def field(field, &block)
- ResourceField.new(self, field, &block)
- end
-
- # call-seq:
- #
- # given(:ensure)
- # given(:ensure => :present)
- def context_with_resource(*args, &block)
- options = args.last.is_a?(Hash) ? args.pop : {}
- if args.empty?
- text = options.map { |k, v| "#{k} => #{v.inspect}" }.join(' and with ')
- context("and with #{text}", {:resource => options}, &block)
- else
- text = args.join(', ')
- placeholders = args.inject({}) { |memo, key| memo.merge(key => 'an-unimportant-value') }
- context("and with a #{text}", {:resource => placeholders}, &block)
- end
- end
-
- def context_without_resource(field, &block)
- context("and without a #{field}", &block)
- end
-
- end
-
-end
-
-Spec::Example::ExampleGroupFactory.register(:provider, ProviderExampleGroup)
-
-def describe_provider(type_name, provider_name, options = {}, &block)
- provider_class = Puppet::Type.type(type_name).provider(provider_name)
- describe(provider_class, options.merge(:type => :provider), &block)
-end