jquery - Evaluating/validating all app JavaScript in a minitest unit test -
is crazy thing attempt? :)
sprockets.context_class.class_eval def image_path(dummy); end def asset_path(dummy); end end sprockets.append_path(rails.root.join('app/assets/javascripts').to_s) asset = sprockets['application.js'] jquery = file.read(file.join(rails.root, "app/assets/javascripts/vendor/jquery.js")) js = execjs.exec jquery + asset.to_s
my premise quite simple. want test loads , validates javascript assets in app. many js.erb
need push them through asset pipeline first (or otherwise evaluate them).
my thinking when load page in chrome validates js app (because it's crammed application.js
), should able unit test. absolutely doesn't work -- keep gettiing random errors, like:
error (0:00:01.874) js files should using correct escaping typeerror: cannot read property 'defaultview' of undefined
but i'm trying isn't special - i'm sure other apps validate js part of tests... right? missing here?
to put clearer question: how can evaluate of js assets in rails unit test?
thank you! :)
Comments
Post a Comment