Class: RSpec::Core::CommandLine

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/core/command_line.rb

Instance Method Summary collapse

Constructor Details

#initialize(options, configuration = RSpec::configuration, world = RSpec::world) ⇒ CommandLine

Returns a new instance of CommandLine.



4
5
6
7
8
9
10
11
12
# File 'lib/rspec/core/command_line.rb', line 4

def initialize(options, configuration=RSpec::configuration, world=RSpec::world)
  if Array === options
    options = ConfigurationOptions.new(options)
    options.parse_options
  end
  @options       = options
  @configuration = configuration
  @world         = world
end

Instance Method Details

#run(err, out) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rspec/core/command_line.rb', line 14

def run(err, out)
  @configuration.error_stream = err
  @configuration.output_stream ||= out
  @options.configure(@configuration)
  @configuration.load_spec_files
  @configuration.configure_mock_framework
  @configuration.configure_expectation_framework
  @world.announce_inclusion_filter
  @world.announce_exclusion_filter

  @configuration.reporter.report(@world.example_count) do |reporter|
    begin
      @configuration.run_hook(:before, :suite)
      @world.example_groups.map {|g| g.run(reporter)}.all?
    ensure
      @configuration.run_hook(:after, :suite)
    end
  end
end