summaryrefslogtreecommitdiff
path: root/spec/support/resource_helpers.rb
diff options
context:
space:
mode:
authorBruce Williams <bruce@codefluency.com>2010-03-18 01:52:34 -0700
committerBruce Williams <bruce@codefluency.com>2010-03-18 01:52:34 -0700
commit94800be9501c9831c6b9317f52468d24c76d57b9 (patch)
tree158a22297e692a16ba72af4681ffa6437fca5e85 /spec/support/resource_helpers.rb
parente7d7e2217d54d8c87dd9897f4fe1bfbdb5038d02 (diff)
Move support file
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