The 3.0.2 update to rails made a change in active support that creates an interference pattern failure in the jasmine-gem. Not jasmine, itself, mind you, just the standalone server that runs the jasmine tests, and not the server, but just the report runner. Thus, your tests are all green, but the jasmine suite fails anyway. You might see this error:
undefined method `merge' for #<JSON::Pure::Generator::State:0x102181890> (NoMethodError)
The selenium driver inside the jasmine gem is loadingjson_pure
unless it can find an already loaded JSON
class. json_pure
was hacked by rails for other reasons, but it breaks JSON.generate
. Madness ensues.
To fix this, you need to use something other than json_pure
, at least in your test suite. The fix, fortunately, is pretty simple. Add the following line to your Gemfile
gem "json", "1.4.6"
This will load the json
gem built with native extensions. The version number is not necessary to fix this problem, but we try to lock down versions as a standard practice.
This was maddeningly painful to pinpoint. I’m not sure if there’s a long term solution to the problem either. You need a JSON
library, but so do many others. Monkey patching the class seems really handy, but is prone to break behaviors.
About the Author