~ubuntu-branches/ubuntu/oneiric/puppet/oneiric-security

« back to all changes in this revision

Viewing changes to vendor/gems/rspec/lib/spec/runner/command_line.rb

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Pollock
  • Date: 2009-04-13 17:12:47 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (3.1.3 squeeze) (1.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20090413171247-61zlnwi5esw1lhtv
ImportĀ upstreamĀ versionĀ 0.24.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
require 'spec/runner/option_parser'
2
 
 
3
 
module Spec
4
 
  module Runner
5
 
    # Facade to run specs without having to fork a new ruby process (using `spec ...`)
6
 
    class CommandLine
7
 
      class << self
8
 
        # Runs specs. +argv+ is the commandline args as per the spec commandline API, +err+
9
 
        # and +out+ are the streams output will be written to.
10
 
        def run(instance_rspec_options)
11
 
          # NOTE - this call to init_rspec_options is not spec'd, but neither is any of this
12
 
          # swapping of $rspec_options. That is all here to enable rspec to run against itself
13
 
          # and maintain coverage in a single process. Therefore, DO NOT mess with this stuff
14
 
          # unless you know what you are doing!
15
 
          init_rspec_options(instance_rspec_options)
16
 
          orig_rspec_options = rspec_options
17
 
          begin
18
 
            $rspec_options = instance_rspec_options
19
 
            return $rspec_options.run_examples
20
 
          ensure
21
 
            ::Spec.run = true
22
 
            $rspec_options = orig_rspec_options
23
 
          end
24
 
        end
25
 
      end
26
 
    end
27
 
  end
28
 
end