lib/assert/test.rb in assert-1.1.0 vs lib/assert/test.rb in assert-2.0.0.rc.1
- old
+ new
@@ -1,44 +1,32 @@
+require 'stringio'
require 'assert/result'
-require 'assert/result_set'
-require 'assert/options'
-require 'stringio'
-
module Assert
class Test
- include Assert::Options
- options do
- default_capture_output false
- default_halt_on_fail true
- end
- def self.halt_on_fail?
- ENV['halt_on_fail'] == 'true' || self.options.halt_on_fail
- end
-
# a Test is some code/method to run in the scope of a Context. After a
# a test runs, it should have some assertions which are its results.
attr_reader :name, :code, :context_info
attr_accessor :results, :output
def initialize(name, suite_context_info, code = nil, &block)
@context_info = suite_context_info
@name = name_from_context(name)
@code = (code || block)
- @results = ResultSet.new
+ @results = Result::Set.new
@output = ""
end
def context_class
self.context_info.klass
end
def run(&result_callback)
# setup the a new test run
- @results = ResultSet.new(result_callback)
+ @results = Result::Set.new(result_callback)
run_scope = self.context_class.new(self)
# run the test, capturing its output
begin
run_test_setup(run_scope)
@@ -116,10 +104,10 @@
self.context_class.teardown(scope)
end
end
def capture_output(&block)
- if self.class.options.capture_output
+ if Assert.config.show_output == false
orig_stdout = $stdout.clone
$stdout = capture_io
block.call
$stdout = orig_stdout
else