-
-
Notifications
You must be signed in to change notification settings - Fork 763
/
command_line.rb
35 lines (33 loc) · 1.06 KB
/
command_line.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
module RSpec
module Core
class CommandLine
def initialize(options, configuration=RSpec::configuration, world=RSpec::world)
if Array === options
options = ConfigurationOptions.new(options)
end
@options = options
@configuration = configuration
@world = world
end
# Configures and runs a suite
#
# @param [IO] err
# @param [IO] out
def run(err, out)
@configuration.error_stream = err
@configuration.output_stream = out if @configuration.output_stream == $stdout
@options.configure(@configuration)
@configuration.load_spec_files
@world.announce_filters
@configuration.reporter.report(@world.example_count) do |reporter|
begin
@configuration.hooks.run(:before, :suite)
@world.ordered_example_groups.map {|g| g.run(reporter) }.all? ? 0 : @configuration.failure_exit_code
ensure
@configuration.hooks.run(:after, :suite)
end
end
end
end
end
end