i have rails app combining javascript assets using jammit, , i'd use jasmine bdd-style testing of javascript. i'm wondering if has advice on accessing jammit-generated 'pacakges' within jasmine?
the issue jasmine configured defining list of js files on disk test, , includes files within own test runner page loaded , run in browser.
i reference each of individual js files inside of jasmine.yml config file before they're packaged jammit... however, jammit dealing dependencies between files me, and, more importantly, need access compiled javascript templates jammit produces.
i manually run jammit generate compiled assets first , run jasmine, i'd wind having re-generate assets hand before each test run in order test changes, cramp fast test-driven type workflow.
i'm wondering if somehow:
- mount jammit controller within jasmine's rack server serve out packages jasmine? work same way jammit within rails' development env.
- hook jasmine somehow package assets on every page load before tests executed? slower, save me step , ensure things date.
any suggestions? i'm getting started this, going wrong. advice appreciated. :-)
thanks! -john
here's magic combo you're looking for:
- use guard gem along guard-jammit gem watch changes project's assets
- install livereload plugin in browser of choice , install guard-livereload gem can have browser auto reload whenever specs or assets change.
- fire guard, rake jasmine, load jasmine specs in browser, press live-reload button connect live-reload server guard started
- change files. watch magic happen guard runs jammit , instructs browser refresh jasmine specs.
here's example guardfile started:
guard 'jammit' watch(%r{public/javascripts/(.*)\.js}) watch(%r{app/views/jst/(.*)\.jst}) watch(%r{public/stylesheets/(.*)\.css}) end guard 'livereload', :apply_js_live => false watch(%r{app/.+\.(erb|haml)}) watch(%r{app/helpers/.+\.rb}) watch(%r{public/.+\.(css|js|html)}) watch(%r{config/locales/.+\.yml}) watch(%r{spec/javascripts/.+\.js}) end
Comments
Post a Comment