spec/dummy/tmp/cache/assets/D05/8D0/sprockets%2F319f8f235f452343f1ebf03cb262d23d in teabag-0.7.0 vs spec/dummy/tmp/cache/assets/D05/8D0/sprockets%2F319f8f235f452343f1ebf03cb262d23d in teabag-0.7.1
- old
+ new
@@ -1,9 +1,8 @@
-o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1365130835.090606:@value"Â'{I"
+o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1365828793.445466:@value"Ê'{I"
class:EFI"BundledAsset; FI"logical_path; FI"$teabag/phantomjs/runner_spec.js; TI"
pathname; FI"Z/Users/jejacks0n/Projects/teabag/spec/javascripts/teabag/phantomjs/runner_spec.coffee; FI"content_type; FI"application/javascript; FI"
-mtime; FI"2013-02-16T14:42:32-07:00; FI"length; FiØ%I"digest; F"%e184e86ce751cceae5bb5d867c5f9fe5I"source; FI"Ø%(function() {
-
+mtime; FI"2013-02-16T14:42:32-07:00; FI"length; Fià%I"digest; F"%3dfd9fea9377bc41f2ac9fbea0c3823cI"source; FI"à%(function() {
window.phantom = {
exit: function() {}
};
window.require = function(file) {
@@ -65,10 +64,11 @@
beforeEach(function() {
return this.runner.initPage();
});
it("opens the url in the page", function() {
var spy;
+
spy = spyOn(this.runner.page, "open");
this.runner.loadPage();
return expect(spy).toHaveBeenCalledWith(this.runner.url);
});
return it("attaches all the methods to page", function() {
@@ -88,10 +88,11 @@
this.timeoutSpy = spyOn(window, "setTimeout");
return this.runner.initPage();
});
it("evaluates in the context of the page", function() {
var spy;
+
spy = spyOn(this.runner.page, "evaluate").andReturn(false);
this.runner.waitForResults();
return expect(spy).toHaveBeenCalled();
});
it("sets a timeout of 100ms if not finished", function() {
@@ -99,10 +100,11 @@
this.runner.waitForResults();
return expect(this.timeoutSpy).toHaveBeenCalled();
});
return it("calls finish if Teabag says that it's finished", function() {
var spy;
+
spyOn(this.runner.page, "evaluate").andCallFake(function(f) {
return f();
});
spy = spyOn(this.runner, "finish");
window.Teabag.finished = true;
@@ -116,10 +118,11 @@
expect(this.logSpy).toHaveBeenCalledWith("Error: _message_");
return expect(this.logSpy).toHaveBeenCalledWith('{"_teabag":true,"type":"exception"}');
});
return it("exits with the error code", function() {
var spy;
+
spy = spyOn(phantom, "exit");
this.runner.fail("_message_", 2);
return expect(spy).toHaveBeenCalledWith(2);
});
});
@@ -128,18 +131,20 @@
this.runner.finish();
return expect(this.logSpy).toHaveBeenCalledWith(" ");
});
return it("calls exit with a success code", function() {
var spy;
+
spy = spyOn(phantom, "exit");
this.runner.finish();
return expect(spy).toHaveBeenCalledWith(0);
});
});
describe("#pageCallbacks", function() {
return it("returns an object with the expected methods", function() {
var object;
+
if (!Object.keys) {
return;
}
object = this.runner.pageCallbacks();
return expect(Object.keys(object)).toEqual(["onError", "onConsoleMessage", "onLoadFinished"]);
@@ -166,10 +171,11 @@
this.runner.initPage();
return this.waitSpy = spyOn(this.runner, "waitForResults");
});
it("fails if the status was not success", function() {
var evalSpy, spy;
+
spy = spyOn(this.runner, "fail");
evalSpy = spyOn(this.runner.page, "evaluate").andReturn(true);
this.callbacks.onLoadFinished("failure");
expect(spy).toHaveBeenCalledWith("Failed to load: " + this.runner.url);
expect(evalSpy).toHaveBeenCalled();
@@ -191,14 +197,12 @@
system = require("system");
webpage = require("webpage");
this.Runner = (function() {
-
function Runner() {
- this.waitForResults = __bind(this.waitForResults, this);
- this.url = system.args[1];
+ this.waitForResults = __bind(this.waitForResults, this); this.url = system.args[1];
this.timeout = parseInt(system.args[2] || 180) * 1000;
}
Runner.prototype.run = function() {
this.initPage();
@@ -213,10 +217,11 @@
};
};
Runner.prototype.loadPage = function() {
var method, name, _ref, _results;
+
this.page.open(this.url);
_ref = this.pageCallbacks();
_results = [];
for (name in _ref) {
method = _ref[name];
@@ -225,10 +230,11 @@
return _results;
};
Runner.prototype.waitForResults = function() {
var finished;
+
if ((new Date().getTime() - this.start) >= this.timeout) {
this.fail("Timed out");
}
finished = this.page.evaluate(function() {
return window.Teabag && window.Teabag.finished;
@@ -262,10 +268,11 @@
return phantom.exit(0);
};
Runner.prototype.pageCallbacks = function() {
var _this = this;
+
return {
onError: function(message, trace) {
console.log(JSON.stringify({
_teabag: true,
type: "error",
@@ -286,10 +293,11 @@
return _this.errored = false;
}
},
onLoadFinished: function(status) {
var defined;
+
if (_this.start) {
return;
}
_this.start = new Date().getTime();
defined = _this.page.evaluate(function() {
@@ -309,6 +317,6 @@
})();
new Runner().run();
}).call(this);
-; FI"required_assets_digest; F"%58fb477d2b6632066fd28d55384ad3fbI"
_version; F"%6776f581a4329e299531e1d52aa59832
+; FI"required_assets_digest; F"%5e34d1441476c0bc18acaafef8ccfaaeI"
_version; F"%6776f581a4329e299531e1d52aa59832
\ No newline at end of file