Class: StreamCi::Ruby::Rspec::Runner

Inherits:
RSpec::Core::Runner
  • Object
show all
Defined in:
lib/stream_ci/ruby/rspec/runner.rb

Instance Method Summary collapse

Instance Method Details

#run_specs(example_groups) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/stream_ci/ruby/rspec/runner.rb', line 20

def run_specs(example_groups)
  examples_count = @world.example_count(example_groups)
  success = @configuration.reporter.report(examples_count) do |reporter|
    @configuration.with_suite_hooks do
      # TODO
      # * what does [email protected]_example_failure return?
      # * what does @configuration.failure_exit_code return?

      @no_failures = true

      #
      # until the return status code is 204, keep pulling data
      #

      opts = { query: { api_key: '12345' } } # need to include other params as well
      response = HTTParty.get('https://api.streamci.com/v1/results', opts)

      # until (file_path = open(stream_ci_url).read) == '>>done<<' do
      until response.code == 204 do
        # should we clear the world / example groups before each one?
        # will that mess up reporting?
        #
        # does this need to be the full path or just spec/some/spec/path ?
        load response.body
        unless @world.example_groups.last.run(reporter)
          @no_failures = false
        end
      end

      @no_failures
    end
  end && !@world.non_example_failure

  success ? 0 : @configuration.failure_exit_code
end

#setup(err, out) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/stream_ci/ruby/rspec/runner.rb', line 8

def setup(err, out)
  @configuration.error_stream = err
  @configuration.output_stream = out if @configuration.output_stream == $stdout
  @options.configure(@configuration)

  # TODO
  # * What do these commands do / mean?
  #
  # @configuration.load_spec_files
  # @world.announce_filters
end