From ad632762871b518d349f6206a0a8de0b902df10b Mon Sep 17 00:00:00 2001
From: Nicolas Perriault <nperriault@gmail.com>
Date: Sat, 27 Oct 2012 18:56:18 +0200
Subject: [PATCH] refs #261 - attempt at fixing coffeescript based tests/modules

---
 bin/bootstrap.js                     |  2 +-
 tests/suites/modules/csmodule.coffee |  1 +
 tests/suites/modules/jsmodule.js     |  1 +
 tests/suites/require.js              | 11 +++++++++++
 4 files changed, 14 insertions(+), 1 deletion(-)
 create mode 100644 tests/suites/modules/csmodule.coffee
 create mode 100644 tests/suites/modules/jsmodule.js
 create mode 100644 tests/suites/require.js

diff --git a/bin/bootstrap.js b/bin/bootstrap.js
index 432b398..08c9729 100755
--- a/bin/bootstrap.js
+++ b/bin/bootstrap.js
@@ -203,7 +203,7 @@ function bootstrap(global) {
         }
 
         // Embedded, up-to-date, validatable & controlable CoffeeScript
-        phantom.injectJs(fs.pathJoin(phantom.casperPath, 'node_modules', 'vendors', 'coffee-script.js'));
+        phantom.injectJs(fs.pathJoin(phantom.casperPath, 'modules', 'vendors', 'coffee-script.js'));
 
         // custom global CasperError
         global.CasperError = function CasperError(msg) {
diff --git a/tests/suites/modules/csmodule.coffee b/tests/suites/modules/csmodule.coffee
new file mode 100644
index 0000000..3894981
--- /dev/null
+++ b/tests/suites/modules/csmodule.coffee
@@ -0,0 +1 @@
+exports.ok = true
diff --git a/tests/suites/modules/jsmodule.js b/tests/suites/modules/jsmodule.js
new file mode 100644
index 0000000..3894981
--- /dev/null
+++ b/tests/suites/modules/jsmodule.js
@@ -0,0 +1 @@
+exports.ok = true
diff --git a/tests/suites/require.js b/tests/suites/require.js
new file mode 100644
index 0000000..2addcc3
--- /dev/null
+++ b/tests/suites/require.js
@@ -0,0 +1,11 @@
+/*global casper*/
+/*jshint strict:false*/
+var fs = require('fs');
+var modroot = fs.pathJoin(phantom.casperPath, 'tests', 'suites', 'modules');
+var jsmod = require(fs.pathJoin(modroot, 'jsmodule'));
+var csmod = require(fs.pathJoin(modroot, 'csmodule'));
+
+casper.test.assertTrue(jsmod.ok, 'require() patched version can load a js module');
+casper.test.assertTrue(csmod.ok, 'require() patched version can load a coffeescript module');
+
+casper.test.done();
--
libgit2 0.24.0