o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1354676054.261178: @value"S*{I" class:EFI"ProcessedAsset;FI"logical_path;FI"'teabag/jasmine-console-reporter.js;FI" pathname;FI"_/Users/jejacks0n/Projects/teabag/app/assets/javascripts/teabag/jasmine-console-reporter.js;FI"content_type;FI"application/javascript;FI" mtime;FI"2012-12-04T19:53:22-07:00;FI" length;Fi 'I" digest;F"%10c432777b99b0f1c113abd390988dcfI" source;FI" 'jasmine.TrivialReporter = function(doc) { this.document = doc || document; this.suiteDivs = {}; this.logRunningSpecs = false; }; jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) { var el = document.createElement(type); for (var i = 2; i < arguments.length; i++) { var child = arguments[i]; if (typeof child === 'string') { el.appendChild(document.createTextNode(child)); } else { if (child) { el.appendChild(child); } } } for (var attr in attrs) { if (attr == "className") { el[attr] = attrs[attr]; } else { el.setAttribute(attr, attrs[attr]); } } return el; }; jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) { var showPassed, showSkipped; this.outerDiv = this.createDom('div', { id: 'TrivialReporter', className: 'jasmine_reporter' }, this.createDom('div', { className: 'banner' }, this.createDom('div', { className: 'logo' }, this.createDom('span', { className: 'title' }, "Jasmine"), this.createDom('span', { className: 'version' }, runner.env.versionString())), this.createDom('div', { className: 'options' }, "Show ", showPassed = this.createDom('input', { id: "__jasmine_TrivialReporter_showPassed__", type: 'checkbox' }), this.createDom('label', { "for": "__jasmine_TrivialReporter_showPassed__" }, " passed "), showSkipped = this.createDom('input', { id: "__jasmine_TrivialReporter_showSkipped__", type: 'checkbox' }), this.createDom('label', { "for": "__jasmine_TrivialReporter_showSkipped__" }, " skipped") ) ), this.runnerDiv = this.createDom('div', { className: 'runner running' }, this.createDom('a', { className: 'run_spec', href: '?' }, "run all"), this.runnerMessageSpan = this.createDom('span', {}, "Running..."), this.finishedAtSpan = this.createDom('span', { className: 'finished-at' }, "")) ); this.document.body.appendChild(this.outerDiv); var suites = runner.suites(); for (var i = 0; i < suites.length; i++) { var suite = suites[i]; var suiteDiv = this.createDom('div', { className: 'suite' }, this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"), this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description)); this.suiteDivs[suite.id] = suiteDiv; var parentDiv = this.outerDiv; if (suite.parentSuite) { parentDiv = this.suiteDivs[suite.parentSuite.id]; } parentDiv.appendChild(suiteDiv); } this.startedAt = new Date(); var self = this; showPassed.onclick = function(evt) { if (showPassed.checked) { self.outerDiv.className += ' show-passed'; } else { self.outerDiv.className = self.outerDiv.className.replace(/ show-passed/, ''); } }; showSkipped.onclick = function(evt) { if (showSkipped.checked) { self.outerDiv.className += ' show-skipped'; } else { self.outerDiv.className = self.outerDiv.className.replace(/ show-skipped/, ''); } }; }; jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) { var results = runner.results(); var className = (results.failedCount > 0) ? "runner failed" : "runner passed"; this.runnerDiv.setAttribute("class", className); //do it twice for IE this.runnerDiv.setAttribute("className", className); var specs = runner.specs(); var specCount = 0; for (var i = 0; i < specs.length; i++) { if (this.specFilter(specs[i])) { specCount++; } } var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s"); message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"; this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild); this.finishedAtSpan.appendChild(document.createTextNode("Finished at " + new Date().toString())); }; jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) { var results = suite.results(); var status = results.passed() ? 'passed' : 'failed'; if (results.totalCount === 0) { // todo: change this to check results.skipped status = 'skipped'; } this.suiteDivs[suite.id].className += " " + status; }; jasmine.TrivialReporter.prototype.reportSpecStarting = function(spec) { if (this.logRunningSpecs) { this.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...'); } }; jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) { var results = spec.results(); var status = results.passed() ? 'passed' : 'failed'; if (results.skipped) { status = 'skipped'; } var specDiv = this.createDom('div', { className: 'spec ' + status }, this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"), this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(spec.getFullName()), title: spec.getFullName() }, spec.description)); var resultItems = results.getItems(); var messagesDiv = this.createDom('div', { className: 'messages' }); for (var i = 0; i < resultItems.length; i++) { var result = resultItems[i]; if (result.type == 'log') { messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString())); } else if (result.type == 'expect' && result.passed && !result.passed()) { messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message)); if (result.trace.stack) { messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack)); } } } if (messagesDiv.childNodes.length > 0) { specDiv.appendChild(messagesDiv); } this.suiteDivs[spec.suite.id].appendChild(specDiv); }; jasmine.TrivialReporter.prototype.log = function() { var console = jasmine.getGlobal().console; if (console && console.log) { if (console.log.apply) { console.log.apply(console, arguments); } else { console.log(arguments); // ie fix: console.log.apply doesn't exist on ie } } }; jasmine.TrivialReporter.prototype.getLocation = function() { return this.document.location; }; jasmine.TrivialReporter.prototype.specFilter = function(spec) { var paramMap = {}; var params = this.getLocation().search.substring(1).split('&'); for (var i = 0; i < params.length; i++) { var p = params[i].split('='); paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]); } if (!paramMap.spec) { return true; } return spec.getFullName().indexOf(paramMap.spec) === 0; }; /** Jasmine Reporter that outputs test results to the browser console. Useful for running in a headless environment such as PhantomJs, ZombieJs etc. Usage: // From your html file that loads jasmine: jasmine.getEnv().addReporter(new jasmine.ConsoleReporter()); jasmine.getEnv().execute(); */ (function(jasmine, console) { if (!jasmine) { throw "jasmine library isn't loaded!"; } var ANSI = {} ANSI.color_map = { "green" : 32, "red" : 31 } ANSI.colorize_text = function(text, color) { var color_code = this.color_map[color]; return "\033[" + color_code + "m" + text + "\033[0m"; } var ConsoleReporter = function() { if (!console || !console.log) { throw "console isn't present!"; } this.status = this.statuses.stopped; }; var proto = ConsoleReporter.prototype; proto.statuses = { stopped : "stopped", running : "running", fail : "fail", success : "success" }; proto.reportRunnerStarting = function(runner) { this.status = this.statuses.running; this.start_time = (new Date()).getTime(); this.executed_specs = 0; this.passed_specs = 0; this.log("Starting..."); }; proto.reportRunnerResults = function(runner) { var failed = this.executed_specs - this.passed_specs; var spec_str = this.executed_specs + (this.executed_specs === 1 ? " spec, " : " specs, "); var fail_str = failed + (failed === 1 ? " failure in " : " failures in "); var color = (failed > 0)? "red" : "green"; var dur = (new Date()).getTime() - this.start_time; this.log(""); this.log("Finished"); this.log("-----------------"); this.log(spec_str + fail_str + (dur/1000) + "s.", color); this.status = (failed > 0)? this.statuses.fail : this.statuses.success; /* Print something that signals that testing is over so that headless browsers like PhantomJs know when to terminate. */ this.log(""); this.log("ConsoleReporter finished"); }; proto.reportSpecStarting = function(spec) { this.executed_specs++; }; proto.reportSpecResults = function(spec) { if (spec.results().passed()) { this.passed_specs++; return; } var resultText = spec.suite.description + " : " + spec.description; this.log(resultText, "red"); var items = spec.results().getItems() for (var i = 0; i < items.length; i++) { var trace = items[i].trace.stack || items[i].trace; this.log(trace, "red"); } }; proto.reportSuiteResults = function(suite) { if (!suite.parentSuite) { return; } var results = suite.results(); var failed = results.totalCount - results.passedCount; var color = (failed > 0)? "red" : "green"; this.log(suite.description + ": " + results.passedCount + " of " + results.totalCount + " passed.", color); }; proto.log = function(str, color) { var text = (color != undefined)? ANSI.colorize_text(str, color) : str; console.log(text) }; jasmine.ConsoleReporter = ConsoleReporter; })(jasmine, console); ;FI"dependency_digest;F"%10888ada0f58e1191b9633e7d0d27fd2I"required_paths;F[I"_/Users/jejacks0n/Projects/teabag/app/assets/javascripts/teabag/jasmine-console-reporter.js;FI"dependency_paths;F[{I" path;FI"_/Users/jejacks0n/Projects/teabag/app/assets/javascripts/teabag/jasmine-console-reporter.js;FI" mtime;FI"2012-12-04T19:53:22-07:00;FI" digest;F"%10c432777b99b0f1c113abd390988dcfI" _version;F"%6776f581a4329e299531e1d52aa59832