Module: Spec::Runner

Defined in:
lib/gems/rspec-1.1.12/lib/spec/runner.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/options.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/reporter.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/spec_parser.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/command_line.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/configuration.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/heckle_runner.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/option_parser.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/drb_command_line.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/backtrace_tweaker.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/example_group_runner.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/formatter/base_formatter.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/formatter/html_formatter.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/heckle_runner_unsupported.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/class_and_arguments_parser.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/formatter/profile_formatter.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/formatter/snippet_extractor.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/formatter/specdoc_formatter.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/formatter/base_text_formatter.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/formatter/text_mate_formatter.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/formatter/story/html_formatter.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/formatter/nested_text_formatter.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/formatter/progress_bar_formatter.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/formatter/failing_examples_formatter.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/formatter/story/plain_text_formatter.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/formatter/story/progress_bar_formatter.rb,
lib/gems/rspec-1.1.12/lib/spec/runner/formatter/failing_example_groups_formatter.rb

Defined Under Namespace

Modules: Formatter Classes: BacktraceTweaker, BehaviourRunner, ClassAndArgumentsParser, CommandLine, Configuration, DrbCommandLine, ExampleGroupCreationListener, ExampleGroupRunner, HeckleRunner, Heckler, NoisyBacktraceTweaker, OptionParser, Options, QuietBacktraceTweaker, Reporter, SpecParser

Class Method Summary collapse

Class Method Details

.configurationObject

:nodoc:



25
26
27
# File 'lib/gems/rspec-1.1.12/lib/spec/runner.rb', line 25

def configuration # :nodoc:
  @configuration ||= Spec::Runner::Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Use this to configure various configurable aspects of RSpec:

Spec::Runner.configure do |configuration|
  # Configure RSpec here
end

The yielded configuration object is a Spec::Runner::Configuration instance. See its RDoc for details about what you can do with it.

Yields:



40
41
42
# File 'lib/gems/rspec-1.1.12/lib/spec/runner.rb', line 40

def configure
  yield configuration
end

.exit?Boolean

Returns:

  • (Boolean)


81
82
83
# File 'lib/gems/rspec-1.1.12/lib/spec/runner.rb', line 81

def exit?
  !test_unit_defined? || Test::Unit.run?
end

.optionsObject

:nodoc:



56
57
58
59
60
61
62
# File 'lib/gems/rspec-1.1.12/lib/spec/runner.rb', line 56

def options # :nodoc:
  @options ||= begin
    parser = ::Spec::Runner::OptionParser.new($stderr, $stdout)
    parser.order!(ARGV)
    parser.options
  end
end

.register_at_exit_hookObject

:nodoc:



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/gems/rspec-1.1.12/lib/spec/runner.rb', line 44

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
end

.runObject



76
77
78
79
# File 'lib/gems/rspec-1.1.12/lib/spec/runner.rb', line 76

def run
  return true if run?
  options.run_examples
end

.run?Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/gems/rspec-1.1.12/lib/spec/runner.rb', line 72

def run?
  Runner.options.examples_run?
end

.test_unit_defined?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/gems/rspec-1.1.12/lib/spec/runner.rb', line 68

def test_unit_defined?
  Object.const_defined?(:Test) && Test.const_defined?(:Unit) && Test::Unit.respond_to?(:run?)
end

.use(options) ⇒ Object



64
65
66
# File 'lib/gems/rspec-1.1.12/lib/spec/runner.rb', line 64

def use options
  @options = options
end