Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

39 lines (31 sloc) 1.039 kb
require 'jasmine-core'
require 'sprockets/directive_processor'
class ProcessesJasmineDirectives < Sprockets::DirectiveProcessor
ASSET_TYPES = ["css","js"]
def process_require_jasmine_directive(asset_type)
return unless ASSET_TYPES.include?(asset_type)
send("require_jasmine_#{asset_type}")
send("require_user_#{asset_type}")
end
ASSET_TYPES.each do |asset_type|
define_method "require_jasmine_#{asset_type}" do
Jasmine::Core.send("#{asset_type}_files").each do |f|
context.require_asset "/#{Jasmine::Core.path}/#{f}"
end
end
define_method "require_user_#{asset_type}" do
config = Jasmine::Config.new
config.send("#{asset_type}_files").each do |f|
context.require_asset full_path_for(f,config)
end
end
end
private
def full_path_for(partial_path,config)
if partial_path.include?(config.spec_path)
partial_path.gsub(/#{config.spec_path}/,config.spec_dir)
else
"#{Rails.root}#{partial_path}"
end
end
end
Jump to Line
Something went wrong with that request. Please try again.