PageRenderTime 27ms CodeModel.GetById 7ms app.highlight 16ms RepoModel.GetById 1ms app.codeStats 0ms

/vendor/bundle/jruby/2.1/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb

https://github.com/delowong/logstash
Ruby | 36 lines | 30 code | 2 blank | 4 comment | 1 complexity | bfbd4eb873bf318a72d5865fe7cdb2a7 MD5 | raw file
 1module RSpec
 2  module Core
 3    class CommandLine
 4      def initialize(options, configuration=RSpec::configuration, world=RSpec::world)
 5        if Array === options
 6          options = ConfigurationOptions.new(options)
 7          options.parse_options
 8        end
 9        @options       = options
10        @configuration = configuration
11        @world         = world
12      end
13
14      # Configures and runs a suite
15      #
16      # @param [IO] err
17      # @param [IO] out
18      def run(err, out)
19        @configuration.error_stream = err
20        @configuration.output_stream ||= out
21        @options.configure(@configuration)
22        @configuration.load_spec_files
23        @world.announce_filters
24
25        @configuration.reporter.report(@world.example_count, @configuration.randomize? ? @configuration.seed : nil) do |reporter|
26          begin
27            @configuration.run_hook(:before, :suite)
28            @world.example_groups.ordered.map {|g| g.run(reporter)}.all? ? 0 : @configuration.failure_exit_code
29          ensure
30            @configuration.run_hook(:after, :suite)
31          end
32        end
33      end
34    end
35  end
36end