Any suggestions on how to test the following?
Since it has node attributes, I was hoping chefspec would mock it out, just like it does for resources.
Any idea what I am missing?
1) Reboot starting to get annoyed
undefined method `node' for nil:NilClass
# ./cookbooks/reboot-handler/files/default/reboot.rb:9:in `report'
# ./cookbooks/reboot-handler/spec/reboot_spec.rb:16:in `block (2 levels) in <top (required)>'
Sorry, John, nothing apparent to me. I take it you can confirm that the recipe is indeed being converged?
Appears to be. Obviously I am doing something wrong, and would rather not stub node myself. Hopefully, someone has done this before, can shed some light on this. :)
Hi Jim. I am sorry, but I don't see anything in your repo that tests what I am trying to do.
Thanks for the reply, hoping someone has tested an external file with node attributes before.
Maybe @acrmp can chime in 👍
Here's a modified example that should get you going:
You are good! :) Thank you very much. Was looking for what I was doing wrong. Thanks for helping me with this.
Hi @acrmp. My apologies, I had one more question. I was looking to test that the command was executed. That seems like a valid test, and also wanted to make sure the node.run_list was reset as per some new requirements in my implementation.
Do you have any recommendations on testing the last 2 tests. Again, my apologies for the silly questions, trying to avoid a bunch of manual stubbing.
Ended up figuring it out. Thanks again for your help.