Skip to content

Commit

Permalink
Make expectations support had the proper hook for result output, inst…
Browse files Browse the repository at this point in the history
…ead of ugly monkey patching
  • Loading branch information
olabini committed Jun 13, 2008
1 parent 0ac53f1 commit a71cf3a
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions jtestr/src/ruby/jtestr/expectations_support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,6 @@
require 'expectations'
require 'jtestr/expectations_result_handler'

module Expectations
class SuiteResults
class << self
alias original_new new

def new(*args)
if $__running_jtestr_expectations
JtestR::ExpectationsResultHandler.new($__running_jtestr_expectations)
else
original_new(*args)
end
end
end
end
end

module JtestR
module ExpectationsTestRunning
def add_expectations_groups(group, match_info)
Expand All @@ -44,13 +28,12 @@ def run_expectations(group)
end

begin
$__running_jtestr_expectations = JtestR.result_handler.new(group.name, "example", @output, @output_level)
result_handler = JtestR::ExpectationsResultHandler.new(JtestR.result_handler.new(group.name, "example", @output, @output_level))

result = suite_runner.suite.execute
result = suite_runner.suite.execute(STDOUT, result_handler)

@result &= result.succeeded?
ensure
$__running_jtestr_expectations = nil
suite_runner.suite = old_suite
end

Expand All @@ -59,6 +42,5 @@ def run_expectations(group)
log.err e.inspect
log.err e.backtrace
end

end
end

0 comments on commit a71cf3a

Please sign in to comment.