Skip to content

Instantly share code, notes, and snippets.

@yyandrew
Created November 10, 2014 10:20
Show Gist options
  • Save yyandrew/284725279031f973edd8 to your computer and use it in GitHub Desktop.
Save yyandrew/284725279031f973edd8 to your computer and use it in GitHub Desktop.
def run_in_browser(js, html)
jsfile = Tempfile.new(['js', '.js'])
jsfile.write(js)
jsfile.close
htmlfile = Tempfile.new(['test', '.html'])
htmlfile.write(html)
htmlfile.close
Phantomjs.run(jsfile.path, htmlfile.path)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment