Method: Fog::Rake::TestTask#tests

Defined in:
lib/tasks/test_task.rb

#tests(mocked) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/tasks/test_task.rb', line 22

def tests(mocked)
  Fog::Formatador.display_line
  start = Time.now.to_i
  Thread.main[:results] = []
  threads = Fog.providers.map do |key, value|
    Thread.new do
      Thread.main[:results] << {
        provider: value,
        success: sh("export FOG_MOCK=#{mocked} && bundle exec shindont +#{key}")
      }
    end
  end
  threads.each(&:join)
  Fog::Formatador.display_table(Thread.main[:results].sort { |x, y| x[:provider] <=> y[:provider] })
  Fog::Formatador.display_line("[bold]FOG_MOCK=#{mocked}[/] tests completed in [bold]#{Time.now.to_i - start}[/] seconds")
  Fog::Formatador.display_line
end