chef-boneyard/minitest-chef-handler

undefined method `template'

kadishmal opened this issue · 1 comments

It seems that I can't use Chef's template resource within the test recipe, can I? It gives me the following error:

ERROR: Report handler MiniTest::Chef::Handler raised #<NoMethodError: undefined method `template' for recipe::cubrid::php_driver:Class>

The code I used was:

describe_recipe 'cubrid::php_driver' do
   # Prepare the PHP example code.
   template "#{TEMP_DIR}/get_php_driver_version.php" do
       cwd TEMP_DIR
       source "php_driver/get_php_driver_version.php.erb"
   end
end

Is there a way to use default Chef resources?

Ah, my mistake. I was loading template from within the test file under files/default/tests/minitest/php_driver_test.rb instead of recipes/php_driver.rb. Putting the template code inside the actual recipe, resolved the problem.