lib/netzke/testing/helpers.rb in netzke-testing-1.0.0.0.pre vs lib/netzke/testing/helpers.rb in netzke-testing-1.0.0.0

- old
+ new

@@ -1,5 +1,7 @@ +class MochaSpecsError < RuntimeError; end + module Netzke::Testing::Helpers def run_mocha_spec(path, options = {}) @component = options[:component] || path.camelcase locale = options[:locale] url = netzke_components_path(class: @component, spec: path) @@ -32,22 +34,20 @@ var errors = []; Ext.Array.each(runner.suite.suites[0].tests, function(t) { if (t.err) errors.push([t.title, t.err.toString()]) }); return { test: runner.test.title, success: runner.stats.failures == 0 && runner.stats.tests !=0, - error: runner.test.err && runner.test.err.toString(), errors: errors } JS if !result["success"] sleep 1.year if stop_on_error errors = result["errors"].each_with_index.map do |(title, error), i| - "#{i+1}) #{title}\n#{error}\n\n" + "#{i+1}) in '#{title}':\n#{error}\n" end - raise "Failures:\n#{errors.join}" - raise "Test failed: #{result["test"]}\n#{result["error"]}" + raise MochaSpecsError, errors.join end end end