summaryrefslogtreecommitdiff
path: root/lib/chef_zero/rspec.rb
diff options
context:
space:
mode:
authorChris Doherty <cdoherty@chef.io>2015-12-10 17:07:02 -0800
committerChris Doherty <cdoherty@chef.io>2015-12-10 17:07:02 -0800
commit531944102005a3e8c4e37c9c08e8bb72afb957b5 (patch)
tree641b565c031869e9274ea935df6f0527528b2afe /lib/chef_zero/rspec.rb
parent003900d3aa0d873cda9dec83b73af362fc61d5b1 (diff)
downloadchef-zero-531944102005a3e8c4e37c9c08e8bb72afb957b5.tar.gz
ChefZero::RSpec support for cookbook_artifacts.cd/artifacts-rspec-support
Diffstat (limited to 'lib/chef_zero/rspec.rb')
-rw-r--r--lib/chef_zero/rspec.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/chef_zero/rspec.rb b/lib/chef_zero/rspec.rb
index 8eb2f58..fa10f77 100644
--- a/lib/chef_zero/rspec.rb
+++ b/lib/chef_zero/rspec.rb
@@ -125,6 +125,10 @@ module ChefZero
end
end
+ def cookbook_artifact(name, data, &block)
+ before(chef_server_options[:server_scope]) { cookbook_artifact(name, data, &block) }
+ end
+
def data_bag(name, data, &block)
before(chef_server_options[:server_scope]) { data_bag(name, data, &block) }
end
@@ -223,6 +227,13 @@ module ChefZero
end
end
+ def cookbook_artifact(name, identifier, data, &block)
+ with_object_path("cookbook_artifacts/#{name}") do
+ ChefZero::RSpec.server.load_data({ 'cookbook_artifact' => { name => { identifier => data } } }, current_org)
+ instance_eval(&block) if block_given?
+ end
+ end
+
def data_bag(name, data, &block)
with_object_path("data/#{name}") do
ChefZero::RSpec.server.load_data({ 'data' => { name => data }}, current_org)