Skip to content

Instantly share code, notes, and snippets.

@masarakki
Created April 21, 2013 19:31
Show Gist options
  • Save masarakki/5430755 to your computer and use it in GitHub Desktop.
Save masarakki/5430755 to your computer and use it in GitHub Desktop.
enable to include javascript sources by url in jasmine for using api.googleapis.com
module Jasmine
class UrlMapper
def initialize(config)
@config = config
end
def map_url_paths(paths)
paths.map{|path| path}
end
end
end
module Jasmine
class Configuration
attr_writer :url_files
def js_files_with_url
map(@url_files || lambda { [] }, :url) + js_files_without_url
end
alias_method :js_files_without_url, :js_files
alias_method :js_files, :js_files_with_url
end
end
Jasmine.configure do |config|
config.add_path_mapper(Jasmine::UrlMapper.method(:new))
config.url_files = lambda {
[ 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js',
'http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js'
]
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment