Module: RSpec::Flaky

Defined in:
lib/rspec/flaky.rb

Class Method Summary collapse

Class Method Details

.run_spec(locations, options) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rspec/flaky.rb', line 12

def self.run_spec locations, options
  FileUtils.rm_rf(Pathes.summary_path)
  rspec_options = options.delete(:rspec_options) || ""
  options[:iterations].times do
    if options[:silent]
      Open3.capture2e("FLAKY_SPEC=1 rspec #{locations} #{rspec_options}")
    else
      system("FLAKY_SPEC=1 rspec #{locations} #{rspec_options}")
    end
  end
  Differ.get_result 
  Pathes.summary_path.children.each do |child|
    if child.basename.to_s.start_with?(".:")
      FileUtils.rm_rf(child) unless options[:save_jsons]
    elsif child.basename.to_s == 'database_dumps'
      FileUtils.rm_rf(child) unless options[:dump_db]
    end
  end
end