Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to include external Javascript as a source to Jasmine?

I am trying to configure jasmine.yml (using jasmine gem) to use JQuery served from Google API instead of downloading it locally to my server. I.e.:

src_files:
  - ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js

Unfortunately this does not seem to work, since (as per the comments in the config file) it is looking for filepaths relative to src_dir. Is this not possible then?

Thanks

Ruy

like image 337
Ruy Diaz Avatar asked Oct 06 '11 22:10

Ruy Diaz


1 Answers

I ended up writing the javascript include via spec helper - in my case the Livereload script:

document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>');

It’s a bit hacky but works. You might want to define more accurately where the script is being inserted.

like image 67
polarblau Avatar answered Sep 28 '22 14:09

polarblau