Class: RSpecRedo::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec-redo/runner.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rspec_opts, redo_opts = {}) ⇒ Runner

Returns a new instance of Runner.



28
29
30
31
32
# File 'lib/rspec-redo/runner.rb', line 28

def initialize(rspec_opts, redo_opts = {})
  @rspec_opts = rspec_opts
  @redo_opts = redo_opts
  @total_retries = @retry_count = redo_opts.fetch('retry-count', 1)
end

Instance Attribute Details

#redo_optsObject (readonly)

Returns the value of attribute redo_opts.



26
27
28
# File 'lib/rspec-redo/runner.rb', line 26

def redo_opts
  @redo_opts
end

#retry_countObject

Returns the value of attribute retry_count.



25
26
27
# File 'lib/rspec-redo/runner.rb', line 25

def retry_count
  @retry_count
end

#rspec_optsObject (readonly)

Returns the value of attribute rspec_opts.



26
27
28
# File 'lib/rspec-redo/runner.rb', line 26

def rspec_opts
  @rspec_opts
end

#total_retriesObject (readonly)

Returns the value of attribute total_retries.



26
27
28
# File 'lib/rspec-redo/runner.rb', line 26

def total_retries
  @total_retries
end

Class Method Details

.invoke(args = ARGV.dup) ⇒ Object



6
7
8
9
# File 'lib/rspec-redo/runner.rb', line 6

def invoke(args = ARGV.dup)
  opts = extract!(args)
  new(args, opts).invoke
end

Instance Method Details

#invokeObject



34
35
36
37
38
# File 'lib/rspec-redo/runner.rb', line 34

def invoke
  run # Invoke rspec for the first time
  rerun until $?.success? || retry_count.zero?
  abort! unless $?.success?
end