{"issue":{"state":"closed","created_at":"2011-12-05T07:24:15Z","updated_at":"2011-12-08T14:10:00Z","comments":3,"user":{"gravatar_id":"efa5e524e4fe6a096349cf93688a0a35","id":65949,"url":"https://api.github.com/users/duncan-bayne","avatar_url":"https://secure.gravatar.com/avatar/efa5e524e4fe6a096349cf93688a0a35?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"duncan-bayne"},"body":"I think I'm failing to understand something pretty fundamental here.  \r\n\r\nI'm trying to test some backbone.js views using Jasmine (via jasmine-headless-webkit).  Everything is working well, except that my haml-js templates aren't accessible under test.\r\n\r\nThe following code in my view works fine:\r\n\r\n    render: =>\r\n      html = JST['views/avia_view_template']()\r\n      $(@el).html(html)\r\n\r\n... but when it's run as part of a Jasmine spec I get the following failure:\r\n\r\n    ReferenceError: Can't find variable: JST in /home/duncan/avia/app/assets/javascripts/views/avia_view.js.coffee\r\n\r\nI suspect I'm doing something wrong in `jasmine.yml`. I've explicitly included the template file it still fails:\r\n\r\n    src_files:\r\n      - \"vendor/**/*.{js,coffee}\"\r\n      - \"lib/**/*.{js,coffee}\"\r\n      - app/assets/javascripts/application.js\r\n      - app/assets/javascripts/avia.js\r\n      - app/assets/javascripts/jquery-1.6.4.js\r\n      - app/assets/javascripts/underscore.js\r\n      - app/assets/javascripts/backbone.js\r\n      - app/assets/javascripts/jquery.jqGrid.min.js\r\n      - app/assets/javascripts/views/avia_view_template.jst.hamljs\r\n      - app/assets/javascripts/views/avia_view.js.coffee\r\n\r\nPerhaps I'm just taking the wrong approach here ... should I be using Jasmine to stub & mock out the calls to JST and jQuery?  A strictly unit-testing approach says I should, in which case the lack of template access is a non-issue.\r\n\r\nFYI I've put a bounty on this question over at http://stackoverflow.com/questions/8364013/cant-find-haml-js-templates-during-jasmine-test-run so if you want some karma feel free to chip in there :-)","assignee":null,"id":2446293,"number":88,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"labels":[],"title":"Using hamljs templates with jasmine-headless-webkit?","html_url":"https://github.com/johnbintz/jasmine-headless-webkit/issues/88","closed_at":"2011-12-08T14:10:00Z","url":"https://api.github.com/repos/johnbintz/jasmine-headless-webkit/issues/88","milestone":null},"action":"closed"}