lib/spec/runner.rb in dchelimsky-rspec-1.1.12 vs lib/spec/runner.rb in dchelimsky-rspec-1.1.99.1
- old
+ new
@@ -13,15 +13,14 @@
module Runner
class ExampleGroupCreationListener
def register_example_group(klass)
Spec::Runner.options.add_example_group klass
- Spec::Runner.register_at_exit_hook
end
end
- Spec::Example::ExampleGroupMethods.example_group_creation_listeners << ExampleGroupCreationListener.new
+ Spec::Example::ExampleGroupFactory.example_group_creation_listeners << ExampleGroupCreationListener.new
class << self
def configuration # :nodoc:
@configuration ||= Spec::Runner::Configuration.new
end
@@ -38,21 +37,13 @@
# for details about what you can do with it.
#
def configure
yield configuration
end
-
- def register_at_exit_hook # :nodoc:
- unless @already_registered_at_exit_hook
- at_exit do
- unless $! || run? || Spec::Example::ExampleGroupFactory.registered_or_ancestor_of_registered?(options.example_groups)
- success = run
- exit success if exit?
- end
- end
- @already_registered_at_exit_hook = true
- end
+
+ def autorun # :nodoc:
+ at_exit {exit run unless $!}
end
def options # :nodoc:
@options ||= begin
parser = ::Spec::Runner::OptionParser.new($stderr, $stdout)
@@ -63,26 +54,13 @@
def use options
@options = options
end
- def test_unit_defined?
- Object.const_defined?(:Test) && Test.const_defined?(:Unit) && Test::Unit.respond_to?(:run?)
- end
-
- def run?
- Runner.options.examples_run?
- end
-
def run
- return true if run?
+ return true if options.examples_run?
options.run_examples
end
- def exit?
- !test_unit_defined? || Test::Unit.run?
- end
end
end
-end
-
-require 'spec/interop/test' if Spec::Runner::test_unit_defined?
+end
\ No newline at end of file