You’ve just upgraded to Ruby 2.1 and Ruby is hitting you back with this error?
Failure/Error: Unable to find matching line from backtrace ArgumentError: comparison of NilClass with 0 failed
You are not alone.
Looks like the GC module has been updated in Ruby MRI 2.1
and returning different hash keys now. In my case, this is what caused this error in RSpec
1 2 3 config.after(:each) do slots_number = [slots_number, GC.stat[:heap_live_num]].max end
Since, there is no longer
:heap_live_num hash key returned by Ruby 2.1
method throws an argument error while trying to compare against
The fix was to replace the outdated
:heap_live_num key with the new
1 2 3 config.after(:each) do slots_number = [slots_number, GC.stat[:heap_live_slot]].max end
And we are back in green land now.
So, check to see whether you are referencing the latest hash keys
##### Today my environment was:
- Rails 4.0.2
- MRI Ruby 2.1.0
- Rspec-rails 2.14.1