Skip to content

Instantly share code, notes, and snippets.

@bhauman
Created May 14, 2011 22:10
Show Gist options
  • Select an option

  • Save bhauman/972689 to your computer and use it in GitHub Desktop.

Select an option

Save bhauman/972689 to your computer and use it in GitHub Desktop.
Getting Jasmine to load javascript templates Jammit style
#this file is expecting to be in spec/javascripts/support
require "jammit"
module Jasmine
class Config
def src_files
if simple_config['src_files']
match_files(src_dir, simple_config['src_files'] + [package_jammit_templates])
else
[]
end
end
def package_jammit_templates
filename = 'public/javascripts/compiled_templates_for_spec.js'
File.open(File.expand_path("../../../#{filename}", File.dirname(__FILE__)), 'w') do |f|
f.write Jammit.packager.pack_templates(:application)
end
filename
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment