class Fog::Rake::TestTask

Public Class Methods

new() click to toggle source
# File lib/tasks/test_task.rb, line 7
def initialize
  desc "Run the mocked tests"
  task :test do
    ::Rake::Task[:mock_tests].invoke
  end

  task :mock_tests do
    tests(true)
  end

  task :real_tests do
    tests(false)
  end
end

Public Instance Methods

tests(mocked) click to toggle source
# File lib/tasks/test_task.rb, line 22
def tests(mocked)
  Fog::Formatador.display_line
  start = Time.now.to_i
  threads = []
  Thread.main[:results] = []
  Fog.providers.each do |key, value|
    threads << 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