Sha256: 161962af1073765c2098c07cbdbe63d4331f3b9c5f45773d45b09eb52211d0f6

Contents?: true

Size: 1.12 KB

Versions: 5

Compression:

Stored size: 1.12 KB

Contents

require "rake"
require "rake/tasklib"

module Fog
  module Rake
    class TestTask < ::Rake::TaskLib

      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

      def tests(mocked)
        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 do |thread|
          thread.join
        end
        Formatador.display_table(Thread.main[:results].sort {|x,y| x[:provider] <=> y[:provider]})
        Formatador.display_line("[bold]FOG_MOCK=#{mocked}[/] tests completed in [bold]#{Time.now.to_i - start}[/] seconds")
        Formatador.display_line
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 4 rubygems

Version Path
fog-nirvanix-1.8.2 lib/tasks/test_task.rb
fog-nirvanix-1.8.1 lib/tasks/test_task.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/tasks/test_task.rb
fog-sgonyea-1.8.1 lib/tasks/test_task.rb
fog-1.8.0 lib/tasks/test_task.rb