class EacRubyGemsUtils::Tests::Multiple

Public Instance Methods

ok?() click to toggle source
# File lib/eac_ruby_gems_utils/tests/multiple.rb, line 16
def ok?
  failed_tests.none?
end
only() click to toggle source
# File lib/eac_ruby_gems_utils/tests/multiple.rb, line 20
def only
  options[:only]
end

Private Instance Methods

all_tests_uncached() click to toggle source
# File lib/eac_ruby_gems_utils/tests/multiple.rb, line 26
def all_tests_uncached
  decorated_gems.flat_map(&:tests)
end
clear_logs() click to toggle source
# File lib/eac_ruby_gems_utils/tests/multiple.rb, line 30
def clear_logs
  all_tests.each do |test|
    test.logs.remove_all
  end
end
decorated_gems_uncached() click to toggle source
# File lib/eac_ruby_gems_utils/tests/multiple.rb, line 41
def decorated_gems_uncached
  r = gems
  r = r.select { |gem| only.include?(gem.name) } if only.present?
  r.map { |gem| DecoratedGem.new(gem) }
end
failed_tests_uncached() click to toggle source
# File lib/eac_ruby_gems_utils/tests/multiple.rb, line 47
def failed_tests_uncached
  all_tests.select { |r| r.result == ::EacRubyGemsUtils::Tests::Base::RESULT_FAILED }
end
final_results_banner() click to toggle source
# File lib/eac_ruby_gems_utils/tests/multiple.rb, line 51
def final_results_banner
  if failed_tests.any?
    warn 'Some test did not pass:'
    failed_tests.each do |test|
      infov '  * Test', test
      info test.logs.truncate_all
    end
  else
    success 'All tests passed'
  end
end
prepare_all_gems() click to toggle source
# File lib/eac_ruby_gems_utils/tests/multiple.rb, line 36
def prepare_all_gems
  infom 'Preparing all gems...'
  decorated_gems.each(&:prepare)
end
run() click to toggle source
# File lib/eac_ruby_gems_utils/tests/multiple.rb, line 63
def run
  start_banner
  prepare_all_gems
  test_all_gems
  final_results_banner
ensure
  clear_logs
end
start_banner() click to toggle source
# File lib/eac_ruby_gems_utils/tests/multiple.rb, line 72
def start_banner
  infov 'Gems to test', decorated_gems.count
end
test_all_gems() click to toggle source
# File lib/eac_ruby_gems_utils/tests/multiple.rb, line 76
def test_all_gems
  infom 'Running tests...'
  all_tests.each do |test|
    infov test, Result.new(test.result).tag
  end
end