375gnu
June 13, 2016, 1:49pm
1
Hi!
I’m using jvmargs gem in my recipe:
java_opts = JVMArgs::Args.new(…)
…
java_opts.heap_size(value)
When I run chefspec it says that nil has no method heap_size.
I created a workaround for this:
before do
allow_message_expectations_on_nil
allow(nil).to receive(:heap_size).and_return(nil)
end
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(some_test_double.to receive(:heap_size).with(value_you_are_expecting)
You’ll need to create a mock or stub for the some_test_double
.
375gnu
June 14, 2016, 11:28am
3
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