Chefspec & jvmargs gem


I’m using jvmargs gem in my recipe:
java_opts =…)


When I run chefspec it says that nil has no method heap_size.

I created a workaround for this:
before do
allow(nil).to receive(:heap_size).and_return(nil)

But I don’t think this is a proper way. How to fix this problem properly?

Maybe something like:

allow(JVMArgs::Args).to receive(:new).and_return(some_test_double)
expect( receive(:heap_size).with(value_you_are_expecting)

You’ll need to create a mock or stub for the some_test_double.

thanks, it works!

(if it’s a maillist why I don’t see you reply in my mail?)

@375gnu You may want to check your email notification preferences - there was a bug a while back with Discourse that changed some defaults unintentionally - Check your email settings on Discourse