chef-boneyard / minitest-chef-handler

Run minitest suites after your Chef recipes to check the status of your system.
Other
163 stars 44 forks source link

undefined method `template' #65

Closed kadishmal closed 11 years ago

kadishmal commented 11 years ago

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?

kadishmal commented 11 years ago

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.